@torrent-tv/proxy 2.87.11 → 2.87.13

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.
@@ -428,6 +428,41 @@ test("a store whose readers have gone asks for nothing, one that never had them
428
428
  }
429
429
  });
430
430
 
431
+ test("live piece pins set memory demand when no priority-map range is declared", async () => {
432
+ const { store, directory } = await makeStore(2);
433
+ try {
434
+ await put(store, 0, pieceOf(0));
435
+ await put(store, 1, pieceOf(1));
436
+
437
+ store.pin(0);
438
+ store.pin(1);
439
+ store.pin(2);
440
+
441
+ assert.equal(store.stats().demand.readers, 0, "this read has no priority-map range");
442
+ assert.equal(store.stats().pinned, 3, "the three distinct live pieces are measured");
443
+ assert.equal(store.capacity, 3, "the active read demand expands capacity immediately");
444
+ assert.equal(store.wantedBytes, 3 * PIECE, "the budget owner sees the same measured demand");
445
+
446
+ const revised = store.reviseGrowthCeiling(2 * PIECE);
447
+ assert.equal(revised.ceilingBytes, 3 * PIECE, "a budget pass preserves pieces in active reads");
448
+ assert.equal(revised.belowActiveDemand, true, "the store reports that the machine share was short");
449
+
450
+ await put(store, 2, pieceOf(2));
451
+ assert.ok(store.locate(0), "the first active piece remains resident");
452
+ assert.ok(store.locate(1), "the second active piece remains resident");
453
+ assert.ok(store.locate(2), "the pending active piece obtains a memory slot");
454
+
455
+ store.unpin(0);
456
+ store.unpin(1);
457
+ store.unpin(2);
458
+ const released = store.reviseGrowthCeiling(2 * PIECE);
459
+ assert.equal(released.ceilingBytes, 2 * PIECE, "the measured floor falls after the reads release their pieces");
460
+ } finally {
461
+ await store.destroy();
462
+ await fs.rm(directory, { recursive: true, force: true, maxRetries: 10, retryDelay: 20 });
463
+ }
464
+ });
465
+
431
466
  test("the allowance is never cut below one reader's whole window", async () => {
432
467
  const { store, directory } = await makeStore(16);
433
468
  try {
@@ -438,13 +473,13 @@ test("the allowance is never cut below one reader's whole window", async () => {
438
473
  // which killed every encoder on that file in the field on 2026-08-15.
439
474
  const revised = store.reviseGrowthCeiling(2 * PIECE);
440
475
  assert.equal(revised.ceilingBytes, 10 * PIECE, "one whole window is the floor");
441
- assert.equal(revised.belowAWindow, true, "and the store says the share was smaller than that");
476
+ assert.equal(revised.belowActiveDemand, true, "and the store says the share was smaller than that");
442
477
 
443
478
  // With no reader there is no window to protect and the share is obeyed.
444
479
  store.releaseProtection("video");
445
480
  const obeyed = store.reviseGrowthCeiling(2 * PIECE);
446
481
  assert.equal(obeyed.ceilingBytes, 2 * PIECE);
447
- assert.equal(obeyed.belowAWindow, false);
482
+ assert.equal(obeyed.belowActiveDemand, false);
448
483
  } finally {
449
484
  store.destroy(() => undefined);
450
485
  await fs.rm(directory, { recursive: true, force: true, maxRetries: 10, retryDelay: 20 });