MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / waitForProcessing

Method waitForProcessing

out/cli.cjs:84213–84227  ·  view source on GitHub ↗

* Waits for the given file to be processed, default timeout is 30 mins.

(id, { pollInterval = 5e3, maxWait = 30 * 60 * 1e3 } = {})

Source from the content-addressed store, hash-verified

84211 return this._client.get(`/files/${fileId}/content`, {
84212 ...options,
84213 headers: { Accept: "application/json", ...options?.headers }
84214 });
84215 }
84216 /**
84217 * Waits for the given file to be processed, default timeout is 30 mins.
84218 */
84219 async waitForProcessing(id, { pollInterval = 5e3, maxWait = 30 * 60 * 1e3 } = {}) {
84220 const TERMINAL_STATES = /* @__PURE__ */ new Set(["processed", "error", "deleted"]);
84221 const start = Date.now();
84222 let file = await this.retrieve(id);
84223 while (!file.status || !TERMINAL_STATES.has(file.status)) {
84224 await sleep2(pollInterval);
84225 file = await this.retrieve(id);
84226 if (Date.now() - start > maxWait) {
84227 throw new APIConnectionTimeoutError3({
84228 message: `Giving up on waiting for file ${id} to finish processing after ${maxWait} milliseconds.`
84229 });
84230 }

Callers

nothing calls this directly

Calls 3

sleep2Function · 0.85
retrieveMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected