Ten Past Ten At Night
This runs on a durable workflow engine that recovers by re-executing the workflow function from the top, serving already recorded activity results from the history, and comparing each command the function emits against the command recorded at that position.
func ExportWorkflow(ctx workflow.Context, tenantID string) error {
reportID := uuid.New().String()
if err := workflow.ExecuteActivity(ctx, BuildReport, tenantID, reportID).Get(ctx, nil); err != nil {
return err
}
if time.Now().Hour() >= 22 {
return workflow.ExecuteActivity(ctx, NotifyBatch, reportID).Get(ctx, nil)
}
return workflow.ExecuteActivity(ctx, NotifyNow, reportID).Get(ctx, nil)
}
BuildReport completes at 21:58 and its result is recorded. NotifyNow is scheduled at 21:59 and is still running when the worker process is restarted at 22:03. What happens on the replay?
Sign in to answer questions and track your progress
Sign In