The Reader's background refresh: the first run after firstRunDelayMs,
then one every intervalMinutes, measured from the end of the previous run
so runs never overlap. A run that finds a refresh already going (a manual
one) joins it, by refreshSources's single-flight.
db may be a getter, so the API can hand over its lazily (re)opened
connection. This assumes one API process (true today: the container runs a
single npm run start): two would each run a loop against the same file.
Every timer is unref'd, and stop clears it, so nothing here keeps a
process (or vitest) alive.
The Reader's background refresh: the first run after
firstRunDelayMs, then one everyintervalMinutes, measured from the end of the previous run so runs never overlap. A run that finds a refresh already going (a manual one) joins it, byrefreshSources's single-flight.dbmay be a getter, so the API can hand over its lazily (re)opened connection. This assumes one API process (true today: the container runs a singlenpm run start): two would each run a loop against the same file.Every timer is
unref'd, andstopclears it, so nothing here keeps a process (or vitest) alive.