fix: 延长公网 Provider 文件传输预算

This commit is contained in:
pikastech
2026-07-20 04:49:05 +02:00
parent f214887619
commit f19af3d2a8
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -66,6 +66,10 @@ function checked(result: CommandResult, operation: string): CommandResult {
return result;
}
function transferFailureDetail(result: CommandResult): string {
return [result.stdout.trim(), result.stderr.trim()].filter((value) => value.length > 0).join("\n");
}
function trans(route: string, operation: string[], timeoutMs = 60_000): CommandResult {
return runCommand([transPath, route, ...operation], repositoryRoot, { timeoutMs });
}
@@ -257,11 +261,11 @@ async function benchmark(id: string, target: LinuxInstallTarget, args: string[])
remoteFiles.add(remote);
process.stderr.write(`${JSON.stringify({ event: "provider-apps.linux.benchmark.stage", stage: "upload", round, bytes: spec.transferBytes })}\n`);
const upload = await transAsync(id, ["upload", payload, remote, "--runtime-timeout-ms", "600000"], 600_000, true);
if (upload.exitCode !== 0) throw new Error(`upload failed round=${round}: ${upload.stderr}`);
if (upload.exitCode !== 0) throw new Error(`upload failed round=${round}: ${transferFailureDetail(upload)}`);
const localCopy = join(local, `download-${round}.bin`);
process.stderr.write(`${JSON.stringify({ event: "provider-apps.linux.benchmark.stage", stage: "download", round, bytes: spec.transferBytes })}\n`);
const download = await transAsync(id, ["download", remote, localCopy, "--runtime-timeout-ms", "600000"], 600_000, true);
if (download.exitCode !== 0) throw new Error(`download failed round=${round}: ${download.stderr}`);
if (download.exitCode !== 0) throw new Error(`download failed round=${round}: ${transferFailureDetail(download)}`);
const sha = fileSha256(localCopy);
if (sha !== payloadSha) throw new Error(`download SHA mismatch round=${round}`);
rmSync(localCopy, { force: true });
+1 -1
View File
@@ -925,7 +925,7 @@ async function runRemoteSshOverFrontend(session: FrontendSession, target: string
if (isSshFileTransferOperation(normalizedArgs)) {
const executor: SshRemoteCommandExecutor = {
streamInactivityTimeoutMs: sshRuntimeTimeoutMs(),
runRemoteCommand: (remoteCommand, input) => runRemoteSshWebSocketCaptureRemoteCommand(session, invocation, remoteCommand, input),
runRemoteCommand: (remoteCommand, input, options) => runRemoteSshWebSocketCaptureRemoteCommand(session, invocation, remoteCommand, input, options),
streamRemoteCommand: (remoteCommand, handlers, input, options) => runRemoteSshWebSocketStreamRemoteCommand(session, invocation, remoteCommand, handlers, input, options),
};
return await runSshFileTransferOperation(invocation, normalizedArgs, executor, {