Scheduled Tasks

Scheduled Tasks

A set of background jobs keeps subscriptions and washes in sync with reality without anyone clicking a button. They’re split into two independently-timed sweeps.

Why two sweeps, not one

Only the operational sweep genuinely needs to wait for 3 PM Cairo — that’s when a wash’s “operating day” is considered closed, so checking for no-shows any earlier would always find nothing. The lifecycle jobs (activation, renewal, pausing, expiry, reminders) are pure date comparisons with no relationship to that cutoff.

They used to share one gate, which meant a subscription due to start “today” couldn’t actually go active until the 3 PM-gated bundle happened to run. Splitting them means a subscription now activates as soon as the first check after the overnight protected hours ends — hours earlier in practice.

The protected-hours guardrail

Both sweeps still respect one shared rule: never run during the business’s actual overnight working shift (9 PM – 7 AM Cairo), so nothing destructive (auto-pause, auto-expire, wash cancellation) lands mid-shift.