mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-20 17:02:18 +00:00
Refactor SDK health probe helper
This commit is contained in:
parent
18473e56e4
commit
e7b5551d73
1 changed files with 9 additions and 5 deletions
|
|
@ -693,7 +693,7 @@ export class SandboxAgent {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getHealth(): Promise<HealthResponse> {
|
async getHealth(): Promise<HealthResponse> {
|
||||||
return this.requestJson("GET", `${API_PREFIX}/health`, { skipReadyWait: true });
|
return this.requestHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
async listAgents(options?: { config?: boolean }): Promise<AgentListResponse> {
|
async listAgents(options?: { config?: boolean }): Promise<AgentListResponse> {
|
||||||
|
|
@ -1066,10 +1066,7 @@ export class SandboxAgent {
|
||||||
throwIfAborted(signal);
|
throwIfAborted(signal);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const health = await this.requestJson<HealthResponse>("GET", `${API_PREFIX}/health`, {
|
const health = await this.requestHealth({ signal });
|
||||||
signal,
|
|
||||||
skipReadyWait: true,
|
|
||||||
});
|
|
||||||
if (health.status === "ok") {
|
if (health.status === "ok") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1132,6 +1129,13 @@ export class SandboxAgent {
|
||||||
|
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async requestHealth(options: { signal?: AbortSignal } = {}): Promise<HealthResponse> {
|
||||||
|
return this.requestJson("GET", `${API_PREFIX}/health`, {
|
||||||
|
signal: options.signal,
|
||||||
|
skipReadyWait: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type QueryValue = string | number | boolean | null | undefined;
|
type QueryValue = string | number | boolean | null | undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue