MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / ensureSessionAwake

Function ensureSessionAwake

scripts/mars-session.mjs:76–94  ·  view source on GitHub ↗
({
  api,
  sessionId,
  pollIntervalMs = DEFAULT_POLL_INTERVAL_MS,
  timeoutMs = DEFAULT_TIMEOUT_MS,
})

Source from the content-addressed store, hash-verified

74 * @returns {Promise<{status: string, [key: string]: any}>} the session, once ready
75 */
76export async function ensureSessionAwake({
77 api,
78 sessionId,
79 pollIntervalMs = DEFAULT_POLL_INTERVAL_MS,
80 timeoutMs = DEFAULT_TIMEOUT_MS,
81}) {
82 const deadline = AbortSignal.timeout(timeoutMs);
83 try {
84 return await waitUntilReady(api, sessionId, pollIntervalMs, deadline);
85 } catch (error) {
86 if (deadline.aborted) {
87 throw new Error(
88 `Timed out waiting for session ${sessionId} to become ready.`,
89 { cause: error },
90 );
91 }
92 throw error;
93 }
94}

Callers 1

Calls 1

waitUntilReadyFunction · 0.85

Tested by

no test coverage detected