mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-29 06:13:46 +00:00
fix(hub,cli): stream large generated media in bounded chunks
A 19MB video download traveled as one ~26MB base64 socket ack. On a remote runner behind a slow tunnel (measured ~0.35MB/s k2lab->mini) that exceeds the hub's RPC budget and Bun's HTTP idle cutoff, so the request died with an empty reply at ~50s (and at ~240s after the first timeout bump). The route now probes with a 1MB read that reports total size + mime, then streams the rest chunk by chunk with Content-Length, honours Range/206 for players and download tools (416 on unsatisfiable ranges), and falls back to the legacy full payload when the session process predates this change (it ignores offset/length and reports no size). Also gives media/files/upload RPCs a 300s budget and raises the hub HTTP idle timeout to 240s so a slow transfer is not killed while waiting on the CLI round-trip.
This commit is contained in:
@@ -952,6 +952,10 @@ export type GeneratedImageResponse = {
|
||||
content?: string
|
||||
mimeType?: string
|
||||
fileName?: string
|
||||
/** Total media size when content is a chunk (offset/length requests). */
|
||||
size?: number
|
||||
offset?: number
|
||||
length?: number
|
||||
error?: string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user