Skip to content

Job lifecycle follow-ups: late dependents, CLI retry SQL, starvation, DB clock, MySQL 2038 #31

Closed

Description

@CodingAnarchy

Follow-ups from #19 (most of it fixed in #20, #21 and #29).

Bugs

  • Late dependents stay waiting. A child enqueued with depends_on a parent that has already completed gets dependency_status = 'waiting' and is never released, because resolution only runs when the parent completes. Enqueue should check dependency state and set satisfied (or failed, per the parent's terminal state and workflow policy) immediately.

  • CLI job retry uses raw SQL with a lowercase 'pending' status that the library never writes or reads. Route it through DatabaseQueue (retry_job / retry_dead_job) so it gets transition guards and side effects.

  • CLI spawn stats / spawn pending panic in debug builds: clap short-flag clash, since -q is both --queue and the global --quiet. Add a CLI test that runs Command::debug_assert().

Deferred from #19

  • M4 Weighted selection only considers the top 20 jobs by priority; lower priorities can starve.
  • M6 Due-time checks use the app server's clock (Utc::now()) instead of the DB clock (NOW()), so clock skew between servers shifts scheduling.
  • M7 MySQL TIMESTAMP columns reject dates after 2038-01-19. Consider DATETIME(6) (stored as UTC) via a guarded migration.
  • LOW: queue pause is enforced only by a worker pre-check, not in the dequeue queries.
  • LOW: dependency resolution runs one query per job (N+1). The Postgres array lookup doesn't use the GIN index; MySQL JSON_CONTAINS can't use an index at all.
  • LOW: cancel_workflow leaves running jobs alone.
  • LOW: the next cron run is computed from completion time, so an overrunning job skips a slot.
  • LOW: Postgres get_queue_depth scans pending jobs across all queues.

Part of #7.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions