Commit fa72db5
fix(watson): only intermediate-flush the global search context singleton (#15187)
The intermediate-flush hook patches SearchContextManager.add_to_context at
class level, so it also fires inside update_watson_search_index_for_model's
own ad-hoc context. A task processing a full
WATSON_ASYNC_INDEX_UPDATE_BATCH_SIZE batch re-dispatches a clone of itself,
discards those pks unindexed, and loops forever: queue length stays ~0 while
the worker is pegged republishing the same batches, and nothing gets indexed.
Guard the hook so only the global singleton (the request-path context managed
by AsyncSearchContextMiddleware) intermediate-flushes. Ad-hoc context managers
index their own batch on end(), as stock watson does.
Extracted from the hardening half of #15165 for the bugfix branch.
Co-authored-by: dogboat <dogboat@users.noreply.github.com>1 parent 94990ac commit fa72db5
2 files changed
Lines changed: 29 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
315 | 324 | | |
316 | 325 | | |
317 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
0 commit comments