rl-rock 1.10.0-beta.0 → 1.10.0-beta.1
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/README.md +4 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,6 +52,9 @@ const sandbox = new Sandbox({
|
|
|
52
52
|
await sandbox.start();
|
|
53
53
|
|
|
54
54
|
console.log(`Sandbox ID: ${sandbox.getSandboxId()}`);
|
|
55
|
+
|
|
56
|
+
// 重启沙箱
|
|
57
|
+
await sandbox.restart();
|
|
55
58
|
```
|
|
56
59
|
|
|
57
60
|
### 执行命令
|
|
@@ -237,6 +240,7 @@ interface SandboxConfig {
|
|
|
237
240
|
cpus: number; // CPU 核心数
|
|
238
241
|
autoClearSeconds: number; // 自动清理时间
|
|
239
242
|
startupTimeout: number; // 启动超时
|
|
243
|
+
autoDeleteSeconds?: number | null; // 沙箱自动删除时间(秒),0 表示立即清理,null/undefined 表示不自动删除
|
|
240
244
|
routeKey?: string; // 路由键
|
|
241
245
|
extraHeaders?: Record<string, string>; // 额外请求头
|
|
242
246
|
}
|
package/dist/index.js
CHANGED
|
@@ -2551,7 +2551,7 @@ var Sandbox = class extends AbstractSandbox {
|
|
|
2551
2551
|
raiseForCode(code, `Failed to restart sandbox: ${JSON.stringify(response)}`);
|
|
2552
2552
|
throw new Error(`Failed to restart sandbox: ${JSON.stringify(response)}`);
|
|
2553
2553
|
}
|
|
2554
|
-
await this.waitForAlive({ includeAllStates: true });
|
|
2554
|
+
await this.waitForAlive({ includeAllStates: true, operation: "restart" });
|
|
2555
2555
|
}
|
|
2556
2556
|
async waitForAlive(options) {
|
|
2557
2557
|
await sleep(2e3);
|
|
@@ -2589,8 +2589,9 @@ var Sandbox = class extends AbstractSandbox {
|
|
|
2589
2589
|
}
|
|
2590
2590
|
await sleep(checkInterval);
|
|
2591
2591
|
}
|
|
2592
|
+
const operation = options?.operation ?? "start";
|
|
2592
2593
|
throw new InternalServerRockError(
|
|
2593
|
-
`Failed to
|
|
2594
|
+
`Failed to ${operation} sandbox within ${this.config.startupTimeout}s, sandbox: ${this.toString()}`
|
|
2594
2595
|
);
|
|
2595
2596
|
}
|
|
2596
2597
|
parseErrorMessageFromStatus(status) {
|