Commit 06957ff
module: implement flushCompileCache()
This implements an API for users to intentionally flush the
accumulated compile cache instead of waiting until process
shutdown. It may be useful for application that loads dependencies
first and then either reload itself in other instances, or spawning
other instances that load an overlapping set of its dependencies -
in this case its useful to flush the cache early instead of waiting
until the shutdown of itself.
Currently flushing is triggered by either process
shutdown or user requests. In the future we should simply start the
writes right after module loading on a separate thread, and this method
only blocks until all the pending writes (if any) on the other thread
are finished. In that case, the off-thread writes should finish long
before any attempt of flushing is made so the method would then only
incur a negligible overhead from thread synchronization.
PR-URL: #54971
Fixes: #54770
Fixes: #54465
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>1 parent 2dcf70c commit 06957ffCopy full SHA for 06957ff
File tree
Expand file treeCollapse file tree
8 files changed
+130
-8
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- internal/modules
- src
- test
- fixtures
- parallel
Expand file treeCollapse file tree
8 files changed
+130
-8
lines changedOpen diff view settings
Collapse file
+23Lines changed: 23 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
199 | 199 | |
200 | 200 | |
201 | 201 | |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
202 | 209 | |
203 | 210 | |
204 | 211 | |
| ||
1101 | 1108 | |
1102 | 1109 | |
1103 | 1110 | |
| 1111 | + |
| 1112 | + |
| 1113 | + |
| 1114 | + |
| 1115 | + |
| 1116 | + |
| 1117 | + |
| 1118 | + |
| 1119 | + |
| 1120 | + |
| 1121 | + |
| 1122 | + |
| 1123 | + |
| 1124 | + |
| 1125 | + |
1104 | 1126 | |
1105 | 1127 | |
1106 | 1128 | |
| ||
1216 | 1238 | |
1217 | 1239 | |
1218 | 1240 | |
| 1241 | + |
1219 | 1242 | |
1220 | 1243 | |
1221 | 1244 | |
|
Collapse file
lib/internal/modules/helpers.js
Copy file name to clipboardExpand all lines: lib/internal/modules/helpers.js+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
40 | 40 | |
41 | 41 | |
42 | 42 | |
| 43 | + |
43 | 44 | |
44 | 45 | |
45 | 46 | |
| ||
484 | 485 | |
485 | 486 | |
486 | 487 | |
| 488 | + |
487 | 489 | |
488 | 490 | |
489 | 491 | |
|
Collapse file
+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
7 | 7 | |
8 | 8 | |
9 | 9 | |
| 10 | + |
10 | 11 | |
11 | 12 | |
12 | 13 | |
| ||
15 | 16 | |
16 | 17 | |
17 | 18 | |
| 19 | + |
| 20 | + |
18 | 21 | |
19 | 22 | |
Collapse file
+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
309 | 309 | |
310 | 310 | |
311 | 311 | |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
312 | 319 | |
313 | 320 | |
314 | 321 | |
|
Collapse file
+6-8Lines changed: 6 additions & 8 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
858 | 858 | |
859 | 859 | |
860 | 860 | |
861 | | - |
862 | | - |
863 | | - |
864 | | - |
865 | | - |
866 | | - |
867 | | - |
868 | | - |
| 861 | + |
| 862 | + |
| 863 | + |
| 864 | + |
| 865 | + |
| 866 | + |
869 | 867 | |
870 | 868 | |
871 | 869 | |
|
Collapse file
+21Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
435 | 435 | |
436 | 436 | |
437 | 437 | |
| 438 | + |
| 439 | + |
| 440 | + |
| 441 | + |
| 442 | + |
| 443 | + |
| 444 | + |
| 445 | + |
| 446 | + |
| 447 | + |
| 448 | + |
| 449 | + |
| 450 | + |
| 451 | + |
| 452 | + |
| 453 | + |
| 454 | + |
| 455 | + |
| 456 | + |
438 | 457 | |
439 | 458 | |
440 | 459 | |
| ||
480 | 499 | |
481 | 500 | |
482 | 501 | |
| 502 | + |
483 | 503 | |
484 | 504 | |
485 | 505 | |
| ||
512 | 532 | |
513 | 533 | |
514 | 534 | |
| 535 | + |
515 | 536 | |
516 | 537 | |
517 | 538 | |
|
Collapse file
test/fixtures/compile-cache-flush.js
Copy file name to clipboard+21Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
Collapse file
test/parallel/test-compile-cache-api-flush.js
Copy file name to clipboard+47Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
0 commit comments