Repository navigation
Commit 0120d57
committed
fix(server): concurrent index refreshes share one native progress read
Before: each index refresh that waited for a rescan polled fff's scan
progress with its own native call. ffi-rs runs a `runInNewThread` call on
Node's 4-thread libuv pool, so several refreshes that waited on fff's
picker lock at the same time filled the pool. The event loop stayed
responsive, but asynchronous file system calls in the server waited until
the lock was released.
After: the refreshes that wait on one finder share one in-flight progress
read, so one finder holds at most two pool threads, one for the rescan
call and one for the progress read.
Description:
- The fff-node patch adds `FileFinder.getScanProgressAsync()`. It returns
the pending read when one exists, the same way `scanFilesAsync()` shares
the rescan call. `waitForIndexReady` polls through it.
- A new test in `WorkspaceEntries.test.ts` runs 8 concurrent refreshes on
a real finder and expects at most one progress read in flight. With the
sharing disabled it fails with "expected 8 to be 1".
- Measured on Windows 11 with fff-node 0.11.0 and ffi-rs 1.3.2: a
272,000-file repository with a content index, a 250,000-file folder
moved into it, and one finished run each second. Before, an
`fs.promises.stat` waited 25.4 s and 24.1 s in two runs. After, no
call waited 100 ms or longer.
- Not covered: four finders that wait on their locks at the same time can
still fill the pool.1 parent f3bc16a commit 0120d57
3 files changed
Lines changed: 81 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
795 | 839 | | |
796 | 840 | | |
797 | 841 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
48 | 60 | | |
49 | | - | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
| |||
348 | 360 | | |
349 | 361 | | |
350 | 362 | | |
351 | | - | |
| 363 | + | |
352 | 364 | | |
353 | 365 | | |
354 | 366 | | |
355 | 367 | | |
| 368 | + | |
356 | 369 | | |
357 | 370 | | |
358 | 371 | | |
359 | 372 | | |
360 | | - | |
| 373 | + | |
361 | 374 | | |
362 | 375 | | |
363 | 376 | | |
| |||
374 | 387 | | |
375 | 388 | | |
376 | 389 | | |
377 | | - | |
| 390 | + | |
378 | 391 | | |
379 | 392 | | |
380 | 393 | | |
| |||
392 | 405 | | |
393 | 406 | | |
394 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
395 | 422 | | |
396 | 423 | | |
397 | 424 | | |
| |||
403 | 430 | | |
404 | 431 | | |
405 | 432 | | |
406 | | - | |
| 433 | + | |
407 | 434 | | |
408 | 435 | | |
409 | 436 | | |
410 | 437 | | |
411 | 438 | | |
412 | | - | |
413 | | - | |
414 | | - | |
| 439 | + | |
415 | 440 | | |
416 | 441 | | |
417 | 442 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments