Bree Plugin Jitter
Description
Deterministic jitter plugin for Bree scheduler - prevents thundering herd when multiple jobs share the same cron schedule
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
README
bree-plugin-jitter
Deterministic jitter for [Bree](https://github.com/breejs/bree) scheduled jobs. Prevents the thundering herd problem when multiple jobs share the same cron schedule.
The problem
When you have multiple Bree jobs on the same cron (e.g. `*/5 * * * *`), they all fire at the exact same second. If those jobs compete for shared resources (SSH connections, database pools, APIs), they can cause timeouts, connection failures, and cascading errors.
The solution
This plugin adds a small, deterministic delay before each job starts. The delay is derived from a hash of the job name, so:
- The same job always gets the same offset (predictable, easy to debug)
- Different jobs with the same cron naturally spread out
- No random variance between runs
Install
npm install bree-plugin-jitter
Usage
const Bree = require('bree');
const jitter = require('bree-plugin-jitter');
Bree.extend(jitter);
// Or with options:
Bree.extend(jitter, {
maxMs: 30000, // Maximum jitter in ms (default: 30000)
periodFraction: 0.1, // Fraction of cron period used as ceiling (default: 0.1)
verbose: false // Log jitter delays to console (default: false)
});
const bree = new Bree({
jobs: [
{ name: 'sync-data', cron: '*/5 * * * *' },
{ name: 'health-check', cron: '*/5 * * * *' },
{ name: 'cleanup', cron: '*/5 * * * *' },
]
});
// sync-data starts at :00 + 12.4s
// health-check starts at :00 + 3.8s
// cleanup starts at :00 + 27.1s
How it works
For each job execution:
- The job name is hashed to a stable integer
- The hash is reduced modulo the jitter ceiling
- The job sleeps for that many milliseconds before starting
The jitter ceiling depends on the job's cron period:
| Schedule | Period | Max jitter (at default 10%) |
|---|---|---|
*/2 * * * * |
2 min | 12s |
*/5 * * * * |
5 min | 30s (capped) |
*/15 * * * * |
15 min | 30s (capped) |
0 9 * * * |
daily | 30s (flat cap) |
J
Related Skills
Epic Decompose
Break an epic into task children without creating task branches.
Productivity Claude Code Terminal Title
Gives each Claude Code terminal window a dynamic title describing the work being done
Productivity N8n Skills
Enables AI assistants to directly understand and operate n8n workflows
Productivity Composio Make
Trigger and manage Make (Integromat) scenarios
Productivity Getting Help
career-ops is an open source project maintained in limited time. Here's how to get help efficiently.
Productivity Worktree Status Check
Verify the current worktree environment and show task details.
Productivity