@torrent-tv/proxy 2.97.8 → 2.97.9
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/package.json
CHANGED
|
@@ -71,13 +71,24 @@ export class HostLoad {
|
|
|
71
71
|
fileLengthByKey = new Map();
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* The machine's seconds per megabyte downloaded,
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
74
|
+
* The machine's seconds per megabyte downloaded, as the processor share and
|
|
75
|
+
* the quality offer read it. Null: no established price, so the download is
|
|
76
|
+
* not limited and the offer counts no torrent cost.
|
|
77
|
+
*
|
|
78
|
+
* Not set from the torrent thread's reading below. On 2.97.8 that reading
|
|
79
|
+
* carried the thread's other work — 1287, 217 and 146 ms per MB at the AVI's
|
|
80
|
+
* start, median 263 against 12.5 on the MKV — and held the AVI download at
|
|
81
|
+
* its own film rate; until the price is established it is kept for the log
|
|
82
|
+
* only (torrent-tv/meta#178, control run).
|
|
78
83
|
*/
|
|
79
84
|
observedTorrentCostPerMegabyte = null;
|
|
80
85
|
|
|
86
|
+
/**
|
|
87
|
+
* The torrent thread's processor per downloaded megabyte, its base draw taken
|
|
88
|
+
* off: a reading for the log, used by nothing.
|
|
89
|
+
*/
|
|
90
|
+
torrentThreadCostPerMegabyte = null;
|
|
91
|
+
|
|
81
92
|
/** @type {number[]} Recent readings behind that median. */
|
|
82
93
|
#torrentCostReadings = [];
|
|
83
94
|
|
|
@@ -242,14 +253,15 @@ export class HostLoad {
|
|
|
242
253
|
const readings = [...this.#torrentCostReadings, costPerMegabyte].slice(-READINGS_KEPT);
|
|
243
254
|
this.#torrentCostReadings = readings;
|
|
244
255
|
const median = medianOf(readings);
|
|
245
|
-
if (!movedBeyondScatter(this.
|
|
256
|
+
if (!movedBeyondScatter(this.torrentThreadCostPerMegabyte, median, readings)) {
|
|
246
257
|
return;
|
|
247
258
|
}
|
|
248
|
-
this.
|
|
259
|
+
this.torrentThreadCostPerMegabyte = median;
|
|
249
260
|
logger.info(
|
|
250
261
|
`host-load: the torrent thread costs ${(median * 1000).toFixed(1)}ms of the machine per downloaded MB ` +
|
|
251
262
|
`(median of ${readings.length}, latest ${(costPerMegabyte * 1000).toFixed(1)}ms over ${megabytes.toFixed(1)}MB, ` +
|
|
252
|
-
`its base draw ${((this.#observedThreadBaseDraw ?? 0) * 100).toFixed(1)}% of the machine taken off
|
|
263
|
+
`its base draw ${((this.#observedThreadBaseDraw ?? 0) * 100).toFixed(1)}% of the machine taken off; ` +
|
|
264
|
+
`for the log only, not the download limit or the quality offer)`
|
|
253
265
|
);
|
|
254
266
|
}
|
|
255
267
|
|
|
@@ -650,9 +662,8 @@ export class HostLoad {
|
|
|
650
662
|
*
|
|
651
663
|
* A viewer consumes the file at its own byte rate, and every one of those
|
|
652
664
|
* bytes is downloaded, verified and pushed by this process. Priced per
|
|
653
|
-
* megabyte by
|
|
654
|
-
*
|
|
655
|
-
* work on other threads is not in it. Zero while either term is unmeasured
|
|
665
|
+
* megabyte by `observedTorrentCostPerMegabyte`, which is unset while no price
|
|
666
|
+
* is established. Zero while either term is unmeasured
|
|
656
667
|
* — a guess here would refuse rungs on arithmetic nobody performed.
|
|
657
668
|
*
|
|
658
669
|
* @param {HlsSession} session
|