Repository navigation
Conversation
Prevent thundering-herd retry storms when many concurrent jobs fail simultaneously. Applies ±50% decorrelated jitter to the exponential base delay so retries are spread across time rather than all firing at the same predictable intervals. Fixed backoff type is unaffected. Closes payloadcms#16318
|
Pull Request titles must follow the Conventional Commits specification and have valid scopes. Unknown scope "queues" found in pull request title "fix(queues): add jitter to exponential backoff retry delay". Scope must match one of: cpa, claude, codemod, db-*, db-d1-sqlite, db-mongodb, db-postgres, db-vercel-postgres, db-sqlite, db-d1-sqlite, drizzle, email-*, email-nodemailer, email-resend, eslint, evals, graphql, kv, kv-redis, live-preview, live-preview-react, live-preview-vue, next, payload-cloud, plugin-cloud, plugin-cloud-storage, plugin-ecommerce, plugin-form-builder, plugin-import-export, plugin-mcp, plugin-multi-tenant, plugin-nested-docs, plugin-redirects, plugin-search, plugin-sentry, plugin-seo, plugin-stripe, richtext-*, richtext-lexical, sdk, skills, storage-*, storage-azure, storage-gcs, storage-r2, storage-uploadthing, storage-vercel-blob, storage-s3, translations, ui, templates, examples(/(\w|-)+)?, deps. |
What
Adds decorrelated jitter (±50%) to the exponential backoff delay in
calculateBackoffWaitUntil.Before:
After:
Why
When many concurrent jobs fail at the same time (e.g. a downstream service goes down), deterministic exponential backoff causes them all to retry at exactly the same intervals — creating a "thundering herd" that repeatedly hammers the backend in synchronized waves.
Adding ±50% jitter to the base delay breaks the synchronization and spreads retries across time, which is standard practice recommended by AWS, Google Cloud, and most distributed-systems resilience libraries.
fixedbackoff type is not affected — it continues to use the exact delay as configured.Closes #16318