@torrent-tv/proxy 2.40.1 → 2.41.0
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 +9 -0
- package/package.json +2 -2
- package/routes/api/subtitles/get.js +68 -42
- package/services/hls-session-manager.js +8171 -8171
- package/services/torrent-worker/piece-reader.js +22 -3
|
@@ -761,6 +761,10 @@ export async function* readFragments({
|
|
|
761
761
|
* nothing passed in and no assumption about who is reading.
|
|
762
762
|
*/
|
|
763
763
|
let deliveredBytes = 0;
|
|
764
|
+
// How often this read had to stop, and for how long in total. Reported at the
|
|
765
|
+
// end whatever the outcome, so a read that never stopped is counted too.
|
|
766
|
+
let waitCount = 0;
|
|
767
|
+
let waitedTotalMs = 0;
|
|
764
768
|
const readStartedAt = Date.now();
|
|
765
769
|
const consumeBytesPerSec = () => {
|
|
766
770
|
const seconds = (Date.now() - readStartedAt) / 1000;
|
|
@@ -979,6 +983,8 @@ export async function* readFragments({
|
|
|
979
983
|
const supplyKey = `${torrent?.infoHash ?? "?"}/${file?.name ?? "?"}`;
|
|
980
984
|
noteSteeringOutcome(supplyKey, waitedMs, pushed.asked > 0 || duplicated > 0);
|
|
981
985
|
noteReadMode(supplyKey, waitedMs, readMode);
|
|
986
|
+
waitCount += 1;
|
|
987
|
+
waitedTotalMs += waitedMs;
|
|
982
988
|
noteSupplyWait(supplyKey, file?.name ?? "", waitedMs);
|
|
983
989
|
}
|
|
984
990
|
const widened = nextWindowPieces({
|
|
@@ -1097,9 +1103,22 @@ export async function* readFragments({
|
|
|
1097
1103
|
releaseHeldPin();
|
|
1098
1104
|
releaseHeldPin = null;
|
|
1099
1105
|
}
|
|
1100
|
-
//
|
|
1101
|
-
//
|
|
1102
|
-
// a
|
|
1106
|
+
// What this read did, said once at its end and under EVERY outcome — the
|
|
1107
|
+
// arm it ran under, how much it delivered, and how much of that time was
|
|
1108
|
+
// spent waiting. Until now the arm was named only beside a wait, so a read
|
|
1109
|
+
// that never waited left no trace of which way it had claimed its pieces:
|
|
1110
|
+
// measured 2026-08-19 across eight sessions with zero waits, the log could
|
|
1111
|
+
// not say whether `flat` or `bands` had run even once. A comparison that
|
|
1112
|
+
// only records the bad outcomes cannot say that the good ones happened at
|
|
1113
|
+
// all, and "no wait" is exactly the result worth counting.
|
|
1114
|
+
const readSeconds = (Date.now() - readStartedAt) / 1000;
|
|
1115
|
+
if (deliveredBytes > 0) {
|
|
1116
|
+
logger.info(
|
|
1117
|
+
`read "${String(file?.name ?? "?").slice(0, 40)}" mode=${readMode} ` +
|
|
1118
|
+
`delivered=${(deliveredBytes / 1e6).toFixed(1)}MB in ${readSeconds.toFixed(1)}s ` +
|
|
1119
|
+
`waits=${waitCount} waited=${(waitedTotalMs / 1000).toFixed(1)}s`
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1103
1122
|
// Reached on completion, on cancellation, on a throw, and when the consumer
|
|
1104
1123
|
// stops iterating — a band left behind would keep the swarm fetching for a
|
|
1105
1124
|
// reader that no longer exists.
|