Repository navigation
Commit 158f5fa
authored
fix(file-search): claim a file write that lands on an owner the backfill already queued (#9666)
* fix(file-search): claim a file write that lands on an owner the backfill already queued
Backfill reconciliation wake-ups enter the owner queue as if just dispatched so they rotate in
behind owners woken for a write. A write that landed while such a row was still queued only
advanced its updated_at through the file trigger's upsert, so it kept the reconciliation stamp
and waited behind every older-stamped owner. The same held for an owner that was served, left
queued with work, and then woken again.
Claims now take owners woken since their last dispatch first: never dispatched, or updated_at
later than last_dispatched_at, which every real wake-up (file write, released claim, reaped claim,
artifact-ready requeue) advances and a reconciliation wake-up never does; it no longer touches an
owner already queued. Within each group the dispatch-age rotation is unchanged. Queue timestamps
the comparison reads come from the transaction clock, the same clock the trigger writes.
* fix(file-search): rotate a woken owner whose slots are full by dispatch age
An owner already holding both of its outstanding claims can claim nothing, but a write between
passes kept marking it woken, so with little global capacity left it took every owner turn and
the free slot went unused. Woken owners now go first only while they have a free slot; a full
owner keeps the dispatch-age rotation it had before.
Also gives the due-reconcile work-check case the same one-minute margin as its not-yet-due
counterpart: exactly at the interval it compared a database timestamp with the application
clock and flaked on skew.1 parent 35ab8fe commit 158f5fa
4 files changed
Lines changed: 115 additions & 38 deletions
File tree
- apps/sim/lib/workspace-files/search
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | | - | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | | - | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
408 | 409 | | |
409 | 410 | | |
410 | 411 | | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
417 | 417 | | |
418 | | - | |
419 | | - | |
420 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
421 | 470 | | |
422 | 471 | | |
423 | 472 | | |
424 | | - | |
425 | | - | |
| 473 | + | |
426 | 474 | | |
427 | 475 | | |
428 | 476 | | |
429 | | - | |
| 477 | + | |
430 | 478 | | |
431 | 479 | | |
432 | 480 | | |
433 | 481 | | |
434 | 482 | | |
435 | 483 | | |
436 | 484 | | |
437 | | - | |
| 485 | + | |
438 | 486 | | |
439 | 487 | | |
440 | 488 | | |
| |||
445 | 493 | | |
446 | 494 | | |
447 | 495 | | |
448 | | - | |
449 | | - | |
450 | | - | |
| 496 | + | |
| 497 | + | |
451 | 498 | | |
452 | 499 | | |
453 | 500 | | |
| |||
995 | 1042 | | |
996 | 1043 | | |
997 | 1044 | | |
| 1045 | + | |
| 1046 | + | |
998 | 1047 | | |
999 | | - | |
| 1048 | + | |
1000 | 1049 | | |
1001 | 1050 | | |
1002 | 1051 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
174 | 203 | | |
175 | 204 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 205 | + | |
| 206 | + | |
179 | 207 | | |
180 | 208 | | |
181 | 209 | | |
| |||
185 | 213 | | |
186 | 214 | | |
187 | 215 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
202 | 228 | | |
203 | 229 | | |
204 | 230 | | |
| |||
675 | 701 | | |
676 | 702 | | |
677 | 703 | | |
| 704 | + | |
678 | 705 | | |
679 | 706 | | |
680 | 707 | | |
| |||
687 | 714 | | |
688 | 715 | | |
689 | 716 | | |
690 | | - | |
| 717 | + | |
691 | 718 | | |
692 | 719 | | |
693 | 720 | | |
| |||
0 commit comments