@torrent-tv/proxy 2.72.1 → 2.72.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/services/piece-store/shared-piece-store.js +1512 -1502
- package/test/piece-store-reservations.test.js +31 -8
|
@@ -156,7 +156,12 @@ test("a spill that fails gives back the slot the eviction claimed", async () =>
|
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
// A bound, because the failure this catches is a claim that never ends: without
|
|
160
|
+
// it the check does not fail, it HANGS, and `node --test` then cannot finish at
|
|
161
|
+
// all — which is what happened between 2026-08-31 and 2026-09-03 (roadmap item
|
|
162
|
+
// 54). The store gives up after PINNED_WAIT_MS, so 30 s is ample for the answer
|
|
163
|
+
// and short enough to be a failure rather than a stoppage.
|
|
164
|
+
test("a claim that cannot be met ends in an error, not in waiting for ever", { timeout: 30_000 }, async () => {
|
|
160
165
|
const disk = makeDisk({ holdWrites: true });
|
|
161
166
|
const { store } = makeStore({ pieces: 2, disk });
|
|
162
167
|
try {
|
|
@@ -183,7 +188,7 @@ test("a claim that cannot be met ends in an error, not in waiting for ever", asy
|
|
|
183
188
|
}
|
|
184
189
|
});
|
|
185
190
|
|
|
186
|
-
test("closing the store fails whoever is waiting for room", async () => {
|
|
191
|
+
test("closing the store fails whoever is waiting for room", { timeout: 30_000 }, async () => {
|
|
187
192
|
const disk = makeDisk({ holdWrites: true });
|
|
188
193
|
const { store } = makeStore({ pieces: 2, disk });
|
|
189
194
|
try {
|
|
@@ -194,7 +199,15 @@ test("closing the store fails whoever is waiting for room", async () => {
|
|
|
194
199
|
store.pin(1);
|
|
195
200
|
|
|
196
201
|
const waiting = put(store, 3);
|
|
197
|
-
|
|
202
|
+
// Either counter: the claim waits for the disk first — a block is in flight
|
|
203
|
+
// and the store is full, so evicting another piece would only raise the
|
|
204
|
+
// memory in use — and reaches the pinned wait five seconds later. Asking for
|
|
205
|
+
// `waitedForPins` alone named one of the two ways of waiting and timed out
|
|
206
|
+
// while the store was demonstrably doing the other.
|
|
207
|
+
await until(
|
|
208
|
+
() => store.stats().waitedForPins + store.stats().waitedForDisk > 0,
|
|
209
|
+
"the claim is waiting"
|
|
210
|
+
);
|
|
198
211
|
|
|
199
212
|
await new Promise((resolve) => store.close(resolve));
|
|
200
213
|
await assert.rejects(() => waiting, /closed/);
|
|
@@ -207,20 +220,30 @@ test("closing the store fails whoever is waiting for room", async () => {
|
|
|
207
220
|
}
|
|
208
221
|
});
|
|
209
222
|
|
|
210
|
-
test("a piece written back to memory is not resurrected on disk by its own spill", async () => {
|
|
223
|
+
test("a piece written back to memory is not resurrected on disk by its own spill", { timeout: 30_000 }, async () => {
|
|
211
224
|
const disk = makeDisk({ holdWrites: true });
|
|
212
|
-
const { store } = makeStore({ pieces:
|
|
225
|
+
const { store } = makeStore({ pieces: 4, disk });
|
|
213
226
|
try {
|
|
214
227
|
await put(store, 0);
|
|
215
228
|
await put(store, 1);
|
|
216
229
|
await put(store, 2);
|
|
217
230
|
|
|
218
231
|
// Piece 0 leaves memory because the machine's allowance fell; its write is
|
|
219
|
-
// still in flight. The allowance then recovers
|
|
220
|
-
//
|
|
232
|
+
// still in flight. The allowance then recovers to MORE than it was, so the
|
|
233
|
+
// piece coming back needs no eviction and no wait for that write.
|
|
234
|
+
//
|
|
235
|
+
// Four blocks, not three, and the reason is what this check is about. A
|
|
236
|
+
// block being written out is still memory in use, so with a ceiling of three
|
|
237
|
+
// and one block in flight the store is full, and the claim correctly waits
|
|
238
|
+
// for the disk — which the earlier setup did not allow for, so the check
|
|
239
|
+
// timed out on an admission policy it never meant to measure. Whether a
|
|
240
|
+
// piece arriving while its OWN spill is in flight should be admitted without
|
|
241
|
+
// taking a second block is a real question about the accounting and is
|
|
242
|
+
// roadmap item 9, not this check's subject: the subject is that the spill,
|
|
243
|
+
// when it completes, must not put the stale copy back on disk.
|
|
221
244
|
store.reviseGrowthCeiling(CHUNK * 2);
|
|
222
245
|
await until(() => disk.heldCount > 0, "the spill of piece 0 is in flight");
|
|
223
|
-
store.reviseGrowthCeiling(CHUNK *
|
|
246
|
+
store.reviseGrowthCeiling(CHUNK * 4);
|
|
224
247
|
|
|
225
248
|
// The swarm hands piece 0 back while that write is still going. The store
|
|
226
249
|
// must drop the disk copy AFTER the write has recorded it, not before —
|