Add probe fallbacks and just_check health checks
Browse filesMultiple backend and frontend updates to improve download probe resilience, proxy selection, and quick health checks.
- backendV2: download.portal.helper.ts
- Respect focus_on='cache' only when specified; added logging.
- Support download_url_fallback (URL) and try fallback endpoint if primary probe fails.
- Probe logic now attempts primary endpoint then fallback before throwing.
- backendV2: proxy.helper.ts
- Add shuffleArray utility and use it to randomize service pool order.
- Add test_browserless_token to validate browserless tokens before returning them.
- ServicePool: return richer metadata (size, currentIndex, last_attempt) and track first_valid.
- ServicePoolV2: minor return copy to avoid mutation.
- backendV2: download/t1.ts
- Allow focus_on='cache' in API validation.
- Use provider fallback for server field and add quick 'just_check' ops param when probing internal servers.
- Inspect JSON responses for a passed=false flag and surface as a failure.
- hugging-face-mini-apps (ffmpeg/showtime)
- Add 'just_check' operation handling to return quick health check results (passed:true/false) and short-circuit full processing when appropriate.
- Improve logging and ensure progress endpoint posts use consistent JSON formatting.
- frontendV3
- downloadable-list.module.scss: adjust color tokens for running states and add .size styling.
- downloadable-list.tsx: improved engine polling/start/stop handling, content-length logging, track_process handling, and various UI/state fixes for processing and intervals.
These changes add safer fallbacks for download probing, better proxy token validation and shuffling, and a lightweight 'just_check' health-check path to validate internal transcoding/serving endpoints without running full jobs.
- src/sub-router/ffmpeg.ts +3 -2
- src/sub-router/showtime.ts +41 -14
|
@@ -74,9 +74,10 @@ const sub_router = new Elysia({ prefix: "/ffmpeg" })
|
|
| 74 |
})
|
| 75 |
});
|
| 76 |
|
| 77 |
-
console.log("E_, R_", E_, R_);
|
| 78 |
-
|
| 79 |
if (E_ || !R_ || !R_.probe_data) {
|
|
|
|
|
|
|
|
|
|
| 80 |
const { status, message } = NS_error.F_collect_error_status_n_message({
|
| 81 |
ERR: E_
|
| 82 |
});
|
|
|
|
| 74 |
})
|
| 75 |
});
|
| 76 |
|
|
|
|
|
|
|
| 77 |
if (E_ || !R_ || !R_.probe_data) {
|
| 78 |
+
console.log("\n");
|
| 79 |
+
console.eroor("E_", E_);
|
| 80 |
+
console.log("\n");
|
| 81 |
const { status, message } = NS_error.F_collect_error_status_n_message({
|
| 82 |
ERR: E_
|
| 83 |
});
|
|
@@ -50,7 +50,7 @@ const sub_router = new Elysia({ prefix: "/showtime" })
|
|
| 50 |
|
| 51 |
const data: any = data_b64 || data_key;
|
| 52 |
|
| 53 |
-
if(!data) {
|
| 54 |
return ctx.status(404);
|
| 55 |
}
|
| 56 |
|
|
@@ -79,7 +79,7 @@ const sub_router = new Elysia({ prefix: "/showtime" })
|
|
| 79 |
})
|
| 80 |
),
|
| 81 |
ops: t.Optional(
|
| 82 |
-
t.Union([t.Literal("cmd"), t.Literal("raw"), t.Literal("decode")], {
|
| 83 |
error() {
|
| 84 |
return "Invalid operation, must be one of: cmd, raw, decode";
|
| 85 |
}
|
|
@@ -377,10 +377,11 @@ async function F_handle_process(arg0: {
|
|
| 377 |
? `ENGINE PROGRESS: ${percentage}`
|
| 378 |
: "ENGINE PROCESSING ...";
|
| 379 |
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
}
|
|
|
|
| 384 |
}
|
| 385 |
break;
|
| 386 |
|
|
@@ -389,9 +390,14 @@ async function F_handle_process(arg0: {
|
|
| 389 |
const file_path = current_job?.tmp_path;
|
| 390 |
|
| 391 |
const _ = await serve_download({ file_path, job_id, ctx, request });
|
| 392 |
-
|
| 393 |
if (_) {
|
| 394 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
return _;
|
| 396 |
}
|
| 397 |
}
|
|
@@ -427,7 +433,7 @@ async function F_handle_process(arg0: {
|
|
| 427 |
output_destination
|
| 428 |
});
|
| 429 |
|
| 430 |
-
console.log("FOUND A FILE ============ ", found_file);
|
| 431 |
|
| 432 |
if (typeof found_file === "string" && found_file) {
|
| 433 |
const _ = await serve_download({
|
|
@@ -437,7 +443,14 @@ async function F_handle_process(arg0: {
|
|
| 437 |
request
|
| 438 |
});
|
| 439 |
|
| 440 |
-
if (_)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
} else if (last_failed) {
|
| 442 |
throw Error;
|
| 443 |
}
|
|
@@ -519,11 +532,12 @@ async function F_handle_process(arg0: {
|
|
| 519 |
}
|
| 520 |
|
| 521 |
(async () => {
|
| 522 |
-
if(!progress_update_endpoint) return;
|
| 523 |
|
| 524 |
const [E_, R_] = await NS_promise.F_catch_promise({
|
| 525 |
-
promise: ky
|
| 526 |
-
|
|
|
|
| 527 |
});
|
| 528 |
})();
|
| 529 |
})();
|
|
@@ -706,6 +720,19 @@ async function F_handle_process(arg0: {
|
|
| 706 |
}
|
| 707 |
}
|
| 708 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 709 |
console.log("\n", "PINGING FFMPEG NOW", "\n");
|
| 710 |
|
| 711 |
// -------------------------------
|
|
@@ -1038,7 +1065,7 @@ async function F_handle_process(arg0: {
|
|
| 1038 |
return {
|
| 1039 |
message,
|
| 1040 |
track_process: progress_update_endpoint
|
| 1041 |
-
}
|
| 1042 |
}
|
| 1043 |
|
| 1044 |
bun_proc.exited.then((code: number) => {
|
|
|
|
| 50 |
|
| 51 |
const data: any = data_b64 || data_key;
|
| 52 |
|
| 53 |
+
if (!data) {
|
| 54 |
return ctx.status(404);
|
| 55 |
}
|
| 56 |
|
|
|
|
| 79 |
})
|
| 80 |
),
|
| 81 |
ops: t.Optional(
|
| 82 |
+
t.Union([t.Literal("cmd"), t.Literal("raw"), t.Literal("decode"), t.Literal("just_check")], {
|
| 83 |
error() {
|
| 84 |
return "Invalid operation, must be one of: cmd, raw, decode";
|
| 85 |
}
|
|
|
|
| 377 |
? `ENGINE PROGRESS: ${percentage}`
|
| 378 |
: "ENGINE PROCESSING ...";
|
| 379 |
|
| 380 |
+
return {
|
| 381 |
+
message,
|
| 382 |
+
track_process: progress_update_endpoint,
|
| 383 |
+
...(ops === 'just_check' ? {passed: true} : {})
|
| 384 |
+
};
|
| 385 |
}
|
| 386 |
break;
|
| 387 |
|
|
|
|
| 390 |
const file_path = current_job?.tmp_path;
|
| 391 |
|
| 392 |
const _ = await serve_download({ file_path, job_id, ctx, request });
|
| 393 |
+
|
| 394 |
if (_) {
|
| 395 |
+
if(ops === 'just_check') {
|
| 396 |
+
return {
|
| 397 |
+
passed: true
|
| 398 |
+
}
|
| 399 |
+
}
|
| 400 |
+
console.log("SERVING FILE ============ ", file_path, "\n");
|
| 401 |
return _;
|
| 402 |
}
|
| 403 |
}
|
|
|
|
| 433 |
output_destination
|
| 434 |
});
|
| 435 |
|
| 436 |
+
console.log("FOUND A FILE ============ ", found_file, "\n");
|
| 437 |
|
| 438 |
if (typeof found_file === "string" && found_file) {
|
| 439 |
const _ = await serve_download({
|
|
|
|
| 443 |
request
|
| 444 |
});
|
| 445 |
|
| 446 |
+
if (_) {
|
| 447 |
+
if(ops === 'just_check') {
|
| 448 |
+
return {
|
| 449 |
+
passed: true
|
| 450 |
+
}
|
| 451 |
+
}
|
| 452 |
+
return _;
|
| 453 |
+
}
|
| 454 |
} else if (last_failed) {
|
| 455 |
throw Error;
|
| 456 |
}
|
|
|
|
| 532 |
}
|
| 533 |
|
| 534 |
(async () => {
|
| 535 |
+
if (!progress_update_endpoint) return;
|
| 536 |
|
| 537 |
const [E_, R_] = await NS_promise.F_catch_promise({
|
| 538 |
+
promise: ky.post(progress_update_endpoint, {
|
| 539 |
+
json: { percentage: 100 }
|
| 540 |
+
})
|
| 541 |
});
|
| 542 |
})();
|
| 543 |
})();
|
|
|
|
| 720 |
}
|
| 721 |
}
|
| 722 |
|
| 723 |
+
if(ops === 'just_check') {
|
| 724 |
+
if (file_mode) {
|
| 725 |
+
const found_file = await find_latest_valid_file({
|
| 726 |
+
sbe_id,
|
| 727 |
+
output_destination
|
| 728 |
+
});
|
| 729 |
+
|
| 730 |
+
return {passed: found_file ? true : false}
|
| 731 |
+
}
|
| 732 |
+
|
| 733 |
+
return {}
|
| 734 |
+
}
|
| 735 |
+
|
| 736 |
console.log("\n", "PINGING FFMPEG NOW", "\n");
|
| 737 |
|
| 738 |
// -------------------------------
|
|
|
|
| 1065 |
return {
|
| 1066 |
message,
|
| 1067 |
track_process: progress_update_endpoint
|
| 1068 |
+
};
|
| 1069 |
}
|
| 1070 |
|
| 1071 |
bun_proc.exited.then((code: number) => {
|