mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-20 01:11:18 +00:00
refactor: Remove dead code and stale references (#1950)
Remove the `runWithRetry` function exported from 4 cloud modules (aws, hetzner, gcp, digitalocean) that were defined but never called anywhere in the codebase. Only `fly.ts` uses its own `runWithRetry` internally, so that definition is preserved. Also bump CLI version to 0.10.22 per version policy. Co-authored-by: spawn-qa-bot <qa@openrouter.ai> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0a8d9b7440
commit
95d4ca93bb
5 changed files with 1 additions and 92 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@openrouter/spawn",
|
||||
"version": "0.10.21",
|
||||
"version": "0.10.22",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"spawn": "cli.js"
|
||||
|
|
|
|||
|
|
@ -1132,28 +1132,6 @@ export async function interactiveSession(cmd: string): Promise<number> {
|
|||
return exitCode;
|
||||
}
|
||||
|
||||
// ─── Retry + Wait Helpers ───────────────────────────────────────────────────
|
||||
|
||||
export async function runWithRetry(
|
||||
maxAttempts: number,
|
||||
sleepSec: number,
|
||||
timeoutSecs: number,
|
||||
cmd: string,
|
||||
): Promise<void> {
|
||||
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
||||
try {
|
||||
await runServer(cmd, timeoutSecs);
|
||||
return;
|
||||
} catch {
|
||||
logWarn(`Command failed (attempt ${attempt}/${maxAttempts}): ${cmd.slice(0, 80)}...`);
|
||||
if (attempt < maxAttempts) {
|
||||
await sleep(sleepSec * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Error(`runWithRetry exhausted: ${cmd.slice(0, 80)}...`);
|
||||
}
|
||||
|
||||
// ─── Server Name ────────────────────────────────────────────────────────────
|
||||
|
||||
export async function getServerName(): Promise<string> {
|
||||
|
|
|
|||
|
|
@ -1095,29 +1095,6 @@ export async function interactiveSession(cmd: string, ip?: string): Promise<numb
|
|||
return exitCode;
|
||||
}
|
||||
|
||||
// ─── Retry Helper ────────────────────────────────────────────────────────────
|
||||
|
||||
export async function runWithRetry(
|
||||
maxAttempts: number,
|
||||
sleepSec: number,
|
||||
timeoutSecs: number,
|
||||
cmd: string,
|
||||
): Promise<void> {
|
||||
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
||||
try {
|
||||
await runServer(cmd, timeoutSecs);
|
||||
return;
|
||||
} catch {
|
||||
logWarn(`Command failed (attempt ${attempt}/${maxAttempts}): ${cmd}`);
|
||||
if (attempt < maxAttempts) {
|
||||
await sleep(sleepSec * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
logError(`Command failed after ${maxAttempts} attempts: ${cmd}`);
|
||||
throw new Error(`runWithRetry exhausted: ${cmd}`);
|
||||
}
|
||||
|
||||
// ─── Server Name ─────────────────────────────────────────────────────────────
|
||||
|
||||
export async function getServerName(): Promise<string> {
|
||||
|
|
|
|||
|
|
@ -948,29 +948,6 @@ export async function interactiveSession(cmd: string): Promise<number> {
|
|||
return exitCode;
|
||||
}
|
||||
|
||||
// ─── Retry Helper ───────────────────────────────────────────────────────────
|
||||
|
||||
export async function runWithRetry(
|
||||
maxAttempts: number,
|
||||
sleepSec: number,
|
||||
timeoutSecs: number,
|
||||
cmd: string,
|
||||
): Promise<void> {
|
||||
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
||||
try {
|
||||
await runServer(cmd, timeoutSecs);
|
||||
return;
|
||||
} catch {
|
||||
logWarn(`Command failed (attempt ${attempt}/${maxAttempts}): ${cmd}`);
|
||||
if (attempt < maxAttempts) {
|
||||
await sleep(sleepSec * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
logError(`Command failed after ${maxAttempts} attempts: ${cmd}`);
|
||||
throw new Error(`runWithRetry exhausted: ${cmd}`);
|
||||
}
|
||||
|
||||
// ─── Lifecycle ──────────────────────────────────────────────────────────────
|
||||
|
||||
export async function destroyInstance(name?: string): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -662,29 +662,6 @@ export async function interactiveSession(cmd: string, ip?: string): Promise<numb
|
|||
return exitCode;
|
||||
}
|
||||
|
||||
// ─── Retry Helper ────────────────────────────────────────────────────────────
|
||||
|
||||
export async function runWithRetry(
|
||||
maxAttempts: number,
|
||||
sleepSec: number,
|
||||
timeoutSecs: number,
|
||||
cmd: string,
|
||||
): Promise<void> {
|
||||
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
||||
try {
|
||||
await runServer(cmd, timeoutSecs);
|
||||
return;
|
||||
} catch {
|
||||
logWarn(`Command failed (attempt ${attempt}/${maxAttempts}): ${cmd}`);
|
||||
if (attempt < maxAttempts) {
|
||||
await sleep(sleepSec * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
logError(`Command failed after ${maxAttempts} attempts: ${cmd}`);
|
||||
throw new Error(`runWithRetry exhausted: ${cmd}`);
|
||||
}
|
||||
|
||||
// ─── Server Name ─────────────────────────────────────────────────────────────
|
||||
|
||||
export async function getServerName(): Promise<string> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue