maxTriesReached. Dogs keeps the record so
you can inspect its name, parameters, tries, and identifiers, but those terminal records no longer
need to remain in MongoDB forever.
Dogs now retains them for one week by default and removes them through a MongoDB TTL index.
Configure the retention period
SetmaxTriesReachedRetentionMs when starting the workers. The value is expressed in
milliseconds and applies only to event jobs that reach maxTries:
null when the records must be retained indefinitely:
How expiration works
When an event job reaches its maximum tries, Dogs stores two dates on the job record:maxTriesReachedAtrecords when the job became terminal.expiresAtrecords when the job becomes eligible for deletion.
orionjs.jobs_dogs_records collection has a TTL index on expiresAt with
expireAfterSeconds: 0. Only records with an expiresAt date can expire, so pending and recurrent
jobs are unaffected.
MongoDB’s TTL monitor removes eligible records asynchronously. A record can therefore remain for
a short time after its exact expiresAt value.
Existing maxTriesReached records
EverystartWorkers() call applies the configured retention to existing terminal event jobs.
Records created before this feature use lastRunAt as their retention anchor when available, or
the migration time otherwise.
Changing maxTriesReachedRetentionMs also recalculates expiresAt from the stable
maxTriesReachedAt value. The TTL index itself does not need to be rebuilt when the duration
changes.
See the Jobs guide for retry handling, per-job maxTries, and worker
configuration.