← Back to list
01Issue
BugOpenSwamp ClubPublic
AssigneesNone
Relationships
#5146 Attio sync and sweep work runs on the request Mongo lane, not the background lane
Opened by swamp_lord · 11/26/2026
Problem
Background loops are meant to take the "background" lane (lib/db.ts, lib/app/repos.ts) so that a sweep can never hold a request's connection. Attio follows that rule only for its queue claim: main.ts passes getAttioSyncQueue("background").
The work done for each entry runs on the request pool:
getAttioSyncDeps,getAttioPersonCoverageDeps,getAttioPersonSweepDepsandgetAttioStageSweepDeps(lib/app/repos.ts) openAttioSyncStateongetDatabase().- Every nested repo they pull in is a request-lane singleton with no lane option:
getCollectiveQueryService,getOperativeRepo,getSubscriptionRepo,getSsoQueryService,getCollectiveRepo,getOperativeCrmReadersandgetMigrationRepo. - The sweeps also call
getAttioSyncQueue()with its default request lane. main.tswires most other loops the same way (trial-ended, returning-trial, nurture, scoring): only the queue is on the background lane.
Split out of swamp-club#5091. The 2026-11-24 pool timeouts there turned out to come from a blocked event loop, not this, so this is the lane-rule violation on its own.
Suggested fix
- Give the nested getters a
laneparameter, the waygetAttioSyncQueue(lane)andgetServeLinkRepo(lane)already work. - Wire the Attio deps with
"background". - Decide whether the 10-connection background pool can carry Attio's burst volume (about 20k
queue.attio-sync.*spans per 5 minutes at peak) without starving the other loops' claims. It may need its own lane or a bigger pool, sized against the Atlas per-node limit. - Consider a fitness test asserting that nothing
startBackgroundServiceswires reachesgetDatabase().
02Bog Flow
Open
Click a lifecycle step above to view its details.
03Sludge Pulse
Sign in to post a ripple.