Commit 73baa57
committed
fix(jobs): initialize the queue table inside worker processes
Every worker process died immediately on startup with KeyError: 'jobs',
so no job was ever leased. The blocking process_file endpoint then polled
a job nobody would run until its 1800s timeout, which is what hung the
docling integration job for the full 300s client timeout.
SqlStore learns a table's schema only by declaring it via create_table();
the server does that at startup, but a spawned worker is a fresh process
with empty SQLAlchemy metadata, so its first fetch_all() raised on the
table name. The worker now calls queue.initialize() before entering the
lease loop. create_table() is idempotent, so this attaches to the
server's existing table rather than recreating it.
This was invisible because the crash handler logged exc_info=True, which
the structlog logger renders as a literal field rather than a traceback,
reducing a dead worker pool to one context-free line. The handler now
formats the traceback into the message, since the parent process only
ever sees an exit code.
Verified end-to-end against a real spawned worker with
file_processors=inline::pypdf: the deprecated blocking endpoint returns
chunks, and the async submit/poll/list endpoints reach completed.
Signed-off-by: Charlie Doern <cdoern@redhat.com>1 parent e666431 commit 73baa57
2 files changed
Lines changed: 42 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
106 | 111 | | |
107 | 112 | | |
108 | 113 | | |
| |||
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
132 | | - | |
133 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
150 | 154 | | |
151 | 155 | | |
152 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
0 commit comments