bunqueue v2.9 API referenceall versions · guide
bunqueue
    Preparing search index...

    Function isLeaseFromEarlierGeneration

    • True when lock was created for an earlier processing generation of job, that is, the job was pulled again after the lease was granted. Stall retry deliberately keeps the previous lease as a stale-outcome guard, so a lease in jobLocks is not necessarily the current one.

      Pull stamps startedAt from a clock read taken before the lease is created in the same delivery, so a lease from the current pull always has createdAt >= startedAt. The comparison is strict: a lease created in the same millisecond as the pull belongs to the current generation.

      Parameters

      • job: Pick<Job, "startedAt">
      • lock: Pick<JobLock, "createdAt">

      Returns boolean