Expand description
The tick-interval scaffold shared by every background worker that polls the database on a fixed
period: regrader, chatbot_syncer and the credit registration phase runners.
Structs§
- Periodic
Worker Config - How a worker’s ticking loop should behave, so the loop itself carries none of that per-worker detail.
Functions§
- is_
db_ disconnect - True when an error’s source is a
sqlx::Error::Io, which is usually the database being reset underneath a local development cluster: the caller’s cue to log its own hint and, if it keeps a connection open across ticks, reacquire one. Takes the source directly (error.source()) rather than the error, sinceanyhow::Errordoes not implementstd::error::Error. - run_
periodic_ worker - Runs
bodyonconfig.tick_intervalforever, loggingconfig.still_running_messageeveryconfig.still_running_everyticks. Abodythat returnsErrstops the loop and becomes this function’s return value, the same as an unhandled error used to exit the worker’smain.