@torrent-tv/proxy 2.101.38 → 2.101.39
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 +1 -1
- package/server.js +6 -8
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -708,8 +708,13 @@ export async function startProxyServer({
|
|
|
708
708
|
const waiting = new Set();
|
|
709
709
|
const turn = takeTurns();
|
|
710
710
|
// ONLY THE SEGMENTS WHOSE RANGES ARE NOT KNOWN are worked out, in the
|
|
711
|
-
// order the swarm is to fetch them.
|
|
711
|
+
// order the swarm is to fetch them. Range resolution can use either a
|
|
712
|
+
// direct source index or the fallback reads below; yield between zones
|
|
713
|
+
// in both cases so a large map cannot hold the main thread across its
|
|
714
|
+
// full projection.
|
|
712
715
|
for (const zone of projection.unresolved()) {
|
|
716
|
+
if (!map.isCurrent()) return [];
|
|
717
|
+
await turn();
|
|
713
718
|
if (!map.isCurrent()) return [];
|
|
714
719
|
const reader = readers.get(zone.outputKey);
|
|
715
720
|
if (!reader) continue;
|
|
@@ -764,14 +769,7 @@ export async function startProxyServer({
|
|
|
764
769
|
waiting.add(zone.outputKey);
|
|
765
770
|
continue;
|
|
766
771
|
}
|
|
767
|
-
// The pass shares the thread in equal turns (`takeTurns`): in one
|
|
768
|
-
// stretch the first pass over a film's 4000 zones held the main thread
|
|
769
|
-
// for all of its work, and handed back after every zone it took
|
|
770
|
-
// 14.7-22 s while the start forecast waited for it. What was worked
|
|
771
|
-
// out is kept, so a pass a newer map ends is not lost
|
|
772
|
-
// (torrent-tv/meta#178).
|
|
773
772
|
if (value?.kind === "result") segmentSourceRanges.set(rangesKey, value.ranges);
|
|
774
|
-
if (await turn() && !map.isCurrent()) return [];
|
|
775
773
|
if (value?.kind === "result") {
|
|
776
774
|
convert(value.ranges);
|
|
777
775
|
continue;
|