Sume waitForJob pollInterval is a floor; next_poll_after_seconds wins
waitForJob never polls faster than pollInterval, and a longer next_poll_after_seconds from the server raises the gap. Defaults, timing table, sample.

In @sume-com/sdk, waitForJob(jobId, options) polls GET /v1/jobs/{id}/status until the job is terminal. The pollInterval option defaults to 2 seconds and is a floor: the SDK source says the server's next_poll_after_seconds carries queue backoff the client cannot see, so it raises the gap but never shortens it. The default timeout is 20 minutes.
That means you cannot make a slow image or video job poll faster by lowering the interval below what the server asks, and you do not need a custom sleep loop to be polite.
Resulting gap between reads
| pollInterval | next_poll_after_seconds | Gap used |
|---|---|---|
| 2 s (default) | not set | 2 s |
| 2 s (default) | 5 | 5 s |
| 10 s | 3 | 10 s |
| 5 s | 0 or invalid | 5 s |
Logging the real gap
onStatus runs on every read, including the terminal one, so you can print what the loop actually did.
import { createSumeClient, waitForJob } from "@sume-com/sdk";
const client = createSumeClient({ apiKey: process.env.SUME_API_KEY! });
let previous = Date.now();
const job = await waitForJob("job_01J...", {
client,
pollInterval: 5_000, // a floor: the gap between reads is never shorter
timeout: 10 * 60_000,
onStatus: (status, snapshot) => {
const gap = Date.now() - previous;
previous = Date.now();
console.log(status, `${gap} ms since the last read`, snapshot.next_poll_after_seconds);
},
});
console.log(job.status);Notes
- Reads have their own budget, forty times the write budget on the shipped default, so a 2-second floor on a handful of jobs is nowhere near the limit. See the rate limits table.
waitForJobresolves for any terminal status; it throwsSumeJobTimeoutError(withjobIdandlastStatus) when the timeout hits first. The job keeps running, so keep the id and resume.- For fan-out, a webhook plus a slow poll as backup costs fewer reads than many tight loops.
Sources
Related posts
More in Developers
- Sume webhook fails the 300-second window: find the clock drift
A valid Sume signature still fails if your server clock is more than five minutes off. Tell drift from a bad secret with a small Python check.
- Sume webhook handler over 10 seconds: acknowledge first, then work
Sume gives each webhook attempt 10 seconds. Verify, answer 2xx, then process in the background and dedupe on job_id. Node sample you can run locally.
- Sume webhook rotation: upgrade the verifier before you click Rotate
During a rotation window Sume sends two signatures in one header. A receiver that compares the whole header for equality fails every delivery. Fix it first.
- SvelteKit +server.ts endpoint for an AI video webhook: request.text()
A SvelteKit POST handler reads request.text(), verifies Sume's HMAC over timestamp.body with node:crypto and returns 401 for bad or missing signatures.
Written by Sume