fix(api): pause whole worker on cooldown, only per-job defer for off-hours #65

Merged
root merged 1 commits from dev into main 2026-05-31 16:16:42 +03:00
Owner

Per-job moveToDelayed for cooldown livelocked the worker: the activity key is
refreshed by every user request, so 60s later the deferred job comes back, key
is still set, defers again. Last 3h on prod logged ~1800 deferrals against 12
real inits and one completion every ~6 min.

Tag RateLimitError with a cause. checkCooldown throws "cooldown"; the worker
now calls this.worker.rateLimit(delayMs) and throws Worker.RateLimitError() —
the whole queue waits once instead of cycling every job. checkTimeWindow throws
"time-window"; that branch keeps the existing job.moveToDelayed (per-job) so
EMEX (no scrape window) keeps flowing while PL24/pcat jobs sleep till 09:00.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Per-job moveToDelayed for cooldown livelocked the worker: the activity key is refreshed by every user request, so 60s later the deferred job comes back, key is still set, defers again. Last 3h on prod logged ~1800 deferrals against 12 real inits and one completion every ~6 min. Tag RateLimitError with a `cause`. checkCooldown throws "cooldown"; the worker now calls `this.worker.rateLimit(delayMs)` and throws Worker.RateLimitError() — the whole queue waits once instead of cycling every job. checkTimeWindow throws "time-window"; that branch keeps the existing job.moveToDelayed (per-job) so EMEX (no scrape window) keeps flowing while PL24/pcat jobs sleep till 09:00. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
root added 1 commit 2026-05-31 16:16:36 +03:00
fix(api): pause whole worker on cooldown, only per-job defer for off-hours
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled
1d9f59ba86
Per-job moveToDelayed for cooldown livelocked the worker: the activity key is
refreshed by every user request, so 60s later the deferred job comes back, key
is still set, defers again. Last 3h on prod logged ~1800 deferrals against 12
real inits and one completion every ~6 min.

Tag RateLimitError with a `cause`. checkCooldown throws "cooldown"; the worker
now calls `this.worker.rateLimit(delayMs)` and throws Worker.RateLimitError() —
the whole queue waits once instead of cycling every job. checkTimeWindow throws
"time-window"; that branch keeps the existing job.moveToDelayed (per-job) so
EMEX (no scrape window) keeps flowing while PL24/pcat jobs sleep till 09:00.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
root merged commit d0f62c2eda into main 2026-05-31 16:16:42 +03:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: root/sase.tr#65