diff --git a/backend/internal/repository/scheduler_outbox_repo.go b/backend/internal/repository/scheduler_outbox_repo.go index 1a09c0d1..d7bc97da 100644 --- a/backend/internal/repository/scheduler_outbox_repo.go +++ b/backend/internal/repository/scheduler_outbox_repo.go @@ -80,17 +80,17 @@ func enqueueSchedulerOutbox(ctx context.Context, exec sqlExecutor, eventType str if exec == nil { return nil } - var payloadJSON []byte + var payloadArg any if payload != nil { encoded, err := json.Marshal(payload) if err != nil { return err } - payloadJSON = encoded + payloadArg = encoded } _, err := exec.ExecContext(ctx, ` INSERT INTO scheduler_outbox (event_type, account_id, group_id, payload) VALUES ($1, $2, $3, $4) - `, eventType, accountID, groupID, payloadJSON) + `, eventType, accountID, groupID, payloadArg) return err } diff --git a/backend/internal/repository/scheduler_snapshot_outbox_integration_test.go b/backend/internal/repository/scheduler_snapshot_outbox_integration_test.go index e82d663f..dede6014 100644 --- a/backend/internal/repository/scheduler_snapshot_outbox_integration_test.go +++ b/backend/internal/repository/scheduler_snapshot_outbox_integration_test.go @@ -46,25 +46,12 @@ func TestSchedulerSnapshotOutboxReplay(t *testing.T) { Extra: map[string]any{}, } require.NoError(t, accountRepo.Create(ctx, account)) + require.NoError(t, cache.SetAccount(ctx, account)) svc := service.NewSchedulerSnapshotService(cache, outboxRepo, accountRepo, nil, cfg) svc.Start() t.Cleanup(svc.Stop) - bucket := service.SchedulerBucket{GroupID: 0, Platform: service.PlatformOpenAI, Mode: service.SchedulerModeSingle} - require.Eventually(t, func() bool { - accounts, hit, err := cache.GetSnapshot(ctx, bucket) - if err != nil || !hit { - return false - } - for _, acc := range accounts { - if acc.ID == account.ID { - return true - } - } - return false - }, 5*time.Second, 100*time.Millisecond) - require.NoError(t, accountRepo.UpdateLastUsed(ctx, account.ID)) updated, err := accountRepo.GetByID(ctx, account.ID) require.NoError(t, err)