Skip to content

[HN-041] claimNextDueFlow writes nextRunAt: null at claim time, before run creation #457

Description

@Inakitajes

Problem

At claim time, claimNextDueFlow overwrites nextRunAt with resolveNextRunAt(flow), which returns null for flows without a cronExpression. This null is persisted in the same updateMany that acquires the lease, before the run is created. If the process crashes between claim and run creation, the one-shot schedule is lost.

Location

apps/web/src/lib/services/flow-leases.ts:71-88 (caller: apps/web/src/lib/flows/scheduler.ts:91-98)

Impact

A crash window for non-cron scheduled flows silently abandons the execution with no reschedule path.

Suggested fix

Only advance/null nextRunAt after the run has been durably created, so a pre-run crash leaves the flow re-claimable.

Source: code investigation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendÁrea: Backend/APIbugSomething isn't workingconcurrencyConcurrency / race conditionseverity:lowLow severity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions