MCPcopy Create free account
hub / github.com/cloudconvert/cloudconvert-cli / pollJobStatus

Function pollJobStatus

src/job.ts:246–270  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

244 pollInterval.unref?.();
245
246 async function pollJobStatus(): Promise<void> {
247 if (callbacks.isSettled() || polling) {
248 return;
249 }
250
251 polling = true;
252 try {
253 const currentJob = await cloudconvert.jobs.get(jobId);
254
255 if (currentJob.status === 'finished') {
256 callbacks.finishJob(currentJob);
257 return;
258 }
259
260 if (currentJob.status === 'error' || currentJob.status === 'failed') {
261 callbacks.failJob(currentJob);
262 }
263 } catch (error) {
264 if (!callbacks.isSettled() && error instanceof Error) {
265 logger.error(`Job status polling failed: ${error.message}`);
266 }
267 } finally {
268 polling = false;
269 }
270 }
271
272 return () => clearInterval(pollInterval);
273}

Callers 1

startJobStatusPollingFunction · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected