Commit ef82a5e
committed
fix(dlx): cap binary/package-json path caches and TTL negative hits
`binaryPathCache` (src/dlx/package.ts) and `packageJsonPathCache`
(src/dlx/detect.ts) were plain `Map`s with no size limit — a long-
running process (devserver, editor extension) that resolved many
distinct paths accumulated entries forever. Adds a 200-entry LRU cap
to both (Map insertion-order = recency, re-insert on hit).
`packageJsonPathCache` also cached negative results (null) without any
expiration. A directory that later gained a package.json (sibling
`npm install`, `pnpm add`, workspace scaffolding) would permanently
return undefined. Negative entries now expire after a 10s TTL and
re-probe — still amortizing the walk in tight loops but not forever.1 parent 555b6f4 commit ef82a5e
2 files changed
Lines changed: 62 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
30 | 52 | | |
31 | 53 | | |
32 | 54 | | |
| |||
62 | 84 | | |
63 | 85 | | |
64 | 86 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
71 | 102 | | |
72 | | - | |
73 | | - | |
74 | 103 | | |
75 | 104 | | |
76 | 105 | | |
| |||
80 | 109 | | |
81 | 110 | | |
82 | 111 | | |
83 | | - | |
| 112 | + | |
84 | 113 | | |
85 | 114 | | |
86 | 115 | | |
87 | 116 | | |
88 | 117 | | |
89 | 118 | | |
90 | 119 | | |
91 | | - | |
| 120 | + | |
92 | 121 | | |
93 | 122 | | |
94 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
67 | 73 | | |
68 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
69 | 87 | | |
70 | 88 | | |
71 | 89 | | |
| |||
887 | 905 | | |
888 | 906 | | |
889 | 907 | | |
| 908 | + | |
| 909 | + | |
890 | 910 | | |
891 | 911 | | |
892 | 912 | | |
| |||
901 | 921 | | |
902 | 922 | | |
903 | 923 | | |
904 | | - | |
| 924 | + | |
905 | 925 | | |
906 | 926 | | |
907 | 927 | | |
| |||
0 commit comments