@torrent-tv/proxy 2.9.131 → 2.9.132
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 +4 -0
- package/package.json +1 -1
- package/services/hls-session-manager.js +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 2.9.132
|
|
2
|
+
|
|
3
|
+
- **New**: A restarted encoder run says what its restart cost, and how much of that was waiting for the previous run to die. A seek costs 5-8 s in the field, and the reason on record — waiting for the previous ffmpeg to exit, measured once at 0.54-1.47 s — does not account for it. The remedy under consideration is a separate output directory per run, which removes the wait entirely but makes serving a segment a search across runs: the hottest path in the proxy, rebuilt on a guess about where the seconds go. So each stage states its own cost first. Two lines: how long SIGTERM took to be obeyed, and the total from the restart being asked for to the new run being announced.
|
|
4
|
+
|
|
1
5
|
## 2.9.131
|
|
2
6
|
|
|
3
7
|
- **Fix**: The first segment of an encoder run is served once the encoder has passed it, instead of waiting for a successor nobody is producing. A segment counted as finished only when the NEXT one had been started — sound while a run moves forward through a file, and meaningless for the segment a run BEGINS at, because the run has only just arrived there. That is precisely the segment a resume or a seek depends on. Measured 2026-08-09 with the hold instrument: `#807 exists, but the next segment (#808) has not been started yet`, held while it lay complete on disk; in August the same shape held `#317` for 46 s and then answered 404 to a browser that had already given up, three releases in a row. A run whose reported output position is past a segment's end has necessarily closed that segment, so that is what decides it now. Covered by a test that builds exactly the resume shape — a run start with no successor on disk — and insists on the bytes.
|
package/package.json
CHANGED
|
@@ -2248,6 +2248,11 @@ export class HlsSessionManager {
|
|
|
2248
2248
|
* @returns {Promise<void>}
|
|
2249
2249
|
*/
|
|
2250
2250
|
async #startEncodeRun(session, startIndex) {
|
|
2251
|
+
// Where a restart's seconds go. A seek costs 5-8 s in the field and the
|
|
2252
|
+
// recorded reason — waiting for the previous ffmpeg to exit, measured at
|
|
2253
|
+
// 0.54-1.47 s — does not account for it. Before rebuilding the hottest path
|
|
2254
|
+
// in the proxy on a guess, make each stage state its own cost.
|
|
2255
|
+
const restartEnteredAt = Date.now();
|
|
2251
2256
|
const generation = ++session.encodeRunGeneration;
|
|
2252
2257
|
const previousFfmpeg = session.ffmpeg;
|
|
2253
2258
|
// A suspended process does not act on SIGTERM until it is continued, so the
|
|
@@ -2259,7 +2264,11 @@ export class HlsSessionManager {
|
|
|
2259
2264
|
} catch {
|
|
2260
2265
|
// Best effort.
|
|
2261
2266
|
}
|
|
2267
|
+
const termSentAt = Date.now();
|
|
2262
2268
|
await waitForChildExit(previousFfmpeg, ENCODE_RUN_TERMINATE_GRACE_MS);
|
|
2269
|
+
logger.info(
|
|
2270
|
+
`transcode ${session.id} restart: previous run took ${Date.now() - termSentAt}ms to exit after SIGTERM`
|
|
2271
|
+
);
|
|
2263
2272
|
if (!hasChildExited(previousFfmpeg)) {
|
|
2264
2273
|
try {
|
|
2265
2274
|
previousFfmpeg.kill("SIGKILL");
|
|
@@ -2492,6 +2501,7 @@ export class HlsSessionManager {
|
|
|
2492
2501
|
|
|
2493
2502
|
logger.info(
|
|
2494
2503
|
`transcode ${session.id} ${session.runLabel} encode-run from segment #${safeIndex} ` +
|
|
2504
|
+
`(+${Date.now() - restartEnteredAt}ms since the restart was asked for) ` +
|
|
2495
2505
|
`(${formatSeconds(startSeconds)}) "${session.fileName}"`
|
|
2496
2506
|
);
|
|
2497
2507
|
|