Skip to content

Requeue failed jobs from AsyncResult__c #50

Description

@Mateusz7410

Motivation

When a job exhausts its retries and lands in Failed, the only recovery today is
to re-run the originating code by hand. An operational requeue would let a
dev or admin re-enqueue a failed job straight from its AsyncResult__c record,
which matters most after a transient outage leaves a batch of jobs failed.

This is distinct from retry(): retry() is automatic, runs inside the failure
path, and is bounded by maxRetries and backoff. Requeue is manual and runs
after a job is already in terminal Failed, with a fresh attempt counter.

Proposal

  • An entry point to re-enqueue a failed job by AsyncResult__c id (or custom job
    id): reconstruct / clone the job and push it back through the normal enqueue
    path with a fresh attempt counter.
  • Optional bulk requeue for a set of failed results.
  • If the monitoring console ships, expose this as a row action / button there.

Notes

  • Requires the job payload to be reconstructable. Document the constraint: either
    the job state is serialized on failure, or requeue is limited to jobs that
    carry their own inputs.
  • Guard with a custom permission so not every user can requeue.

Acceptance criteria

  • Requeue path plus permission gate.
  • Apex tests: single + bulk requeue, non-failed result rejected, missing payload
    handled cleanly.
  • Docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions