diff --git a/backend/controller/cronjobs/cronjobs.go b/backend/controller/cronjobs/cronjobs.go index df838bcf1a..2145305011 100644 --- a/backend/controller/cronjobs/cronjobs.go +++ b/backend/controller/cronjobs/cronjobs.go @@ -174,6 +174,7 @@ func (s *Service) scheduleCronJob(ctx context.Context, tx *Tx, job model.CronJob logger.Tracef("Scheduling cron job %q async_call execution at %s", job.Key, nextAttemptForJob) _, err = tx.db.CreateAsyncCall(ctx, cronsql.CreateAsyncCallParams{ + ScheduledAt: nextAttemptForJob, Verb: schema.RefKey{Module: job.Verb.Module, Name: job.Verb.Name}, Origin: fmt.Sprintf("cron:%s", job.Key), Request: []byte(`{}`), @@ -181,7 +182,6 @@ func (s *Service) scheduleCronJob(ctx context.Context, tx *Tx, job model.CronJob Backoff: 0, MaxBackoff: 0, CronJobKey: optional.Some(job.Key), - ScheduledAt: nextAttemptForJob, }) if err != nil { return fmt.Errorf("failed to create async call for job %q: %w", job.Key, err) diff --git a/backend/controller/dal/fsm.go b/backend/controller/dal/fsm.go index af8e9bf008..8b694f8b48 100644 --- a/backend/controller/dal/fsm.go +++ b/backend/controller/dal/fsm.go @@ -45,6 +45,7 @@ func (d *DAL) StartFSMTransition(ctx context.Context, fsm schema.RefKey, instanc // Create an async call for the event. origin := AsyncOriginFSM{FSM: fsm, Key: instanceKey} asyncCallID, err := d.db.CreateAsyncCall(ctx, sql.CreateAsyncCallParams{ + ScheduledAt: time.Now(), Verb: destinationState, Origin: origin.String(), Request: encryptedRequest, diff --git a/backend/controller/dal/pubsub.go b/backend/controller/dal/pubsub.go index 795201353b..924ef17834 100644 --- a/backend/controller/dal/pubsub.go +++ b/backend/controller/dal/pubsub.go @@ -128,6 +128,7 @@ func (d *DAL) ProgressSubscriptions(ctx context.Context, eventConsumptionDelay t } _, err = tx.db.CreateAsyncCall(ctx, sql.CreateAsyncCallParams{ + ScheduledAt: time.Now(), Verb: subscriber.Sink, Origin: origin.String(), Request: nextCursor.Payload, // already encrypted