Skip to content

Commit 4ed9ddc

Browse files
committed
Add extensive queries section to troubleshooting
1 parent f2f95c0 commit 4ed9ddc

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

guides/advanced/troubleshooting.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,27 @@ COMMENT ON TABLE public.oban_jobs IS '10'"
9696
9797
Once the comment is in place only the migrations from that version onward will
9898
run.
99+
100+
## Database Queries from Every Queue Every Second
101+
102+
If every queue is polling the database every second, job staging has switched from efficient
103+
**global mode** to **local mode**. In global mode, only the leader queries for jobs and notifies
104+
queues via pubsub. In local mode, each queue polls independently.
105+
106+
This typically happens when:
107+
108+
1. No node has leadership (common in development after restarts)
109+
2. Using PgBouncer with transaction pooling (disables pubsub notifications)
110+
3. Running using the `PG` notifier without clustering and functional pubsub
111+
112+
Look for these log messages confirming the switch to local mode:
113+
114+
```
115+
"job staging switched to local mode. local mode polls for jobs for every queue"
116+
```
117+
118+
### Solutions
119+
120+
- Wait for leadership restablishment after a restart in development
121+
- Use `Oban.Peers.Global` in development
122+
- Fix clustering and pubsub notifications in production

0 commit comments

Comments
 (0)