
A bounded worker pool limits how many requests your application has in flight; it does not increase Imagild's account quota or determine how many models run simultaneously. Use a small submission pool, a separate account rate gate and durable per-operation records. Release a submission worker after acceptance, then monitor the resulting task separately.
Key Takeaways
- Concurrency and requests per minute require different controls.
- Save the returned task ID before treating an operation as submitted.
- A failed item should not cause successful items to be submitted again.
Limit the submission stage explicitly
Imagine forty independent image briefs. Starting forty HTTP requests at once creates a burst, even if each request is asynchronous. Conversely, keeping one worker occupied until an entire video finishes can block unrelated submissions unnecessarily.
The Imagild API guide describes individual asynchronous tasks. Your pool should bound the HTTP submission stage and persist its result. A separate monitor handles status reads and eventual downloads. Neither a pool of two nor ten is a guarantee of equivalent provider-side generation concurrency.
Combine a pool with a rate gate
The maintainer's p-limit documentation describes limiting concurrent promise executions. It does not supply a per-minute allowance. The following sketch combines that pattern with application functions you must implement:
import pLimit from "p-limit";
const submitPool = pLimit(2);
const results = await Promise.allSettled(
operations.map(operation => submitPool(async () => {
await accountWriteGate.acquire();
const task = await submitOne(operation.payload, operation.idempotencyKey);
await ledger.saveAccepted(operation.id, task.id);
return { operationId: operation.id, taskId: task.id };
}))
);
accountWriteGate, submitOne and ledger are your application components, not Imagild SDK exports. The gate should coordinate the current ten writes per minute across this account's uploads and submissions, including other workers. submitOne must classify errors and retain the same key for identical retries.
For a very large backlog, fetch a bounded page of operations instead of creating a promise and closure for every item at once. A concurrency cap alone does not bound the memory used by an enormous pending array.
Claim each durable item once
Store a stable operation ID, immutable submitted payload, idempotency key, known task ID and dispatch state before sending work. If multiple application workers can see the same database row, use a transactional claim or lease in your own storage.
Do not infer exactly-once execution merely because a local loop visits each array element once. A process can lose its response or crash after acceptance but before saving the task ID. Recovery should reuse the operation identity and parameters, letting the API's idempotency handling resolve the same generation.
A revised prompt or deliberate retake is a new operation. Keep its relationship to the original item rather than overwriting history.
Keep partial results and dependencies intact
Promise.allSettled lets this sketch collect independent submission outcomes. It does not decide whether a rejected promise represents validation failure, a throttled request or uncertain acceptance. Your recovery layer must classify those cases before dispatching again.
If item B fails while A and C are accepted, retain A and C. Do not restart the whole list. If B depends on A's image output, keep B waiting until A reports succeeded and its owned result is usable. Acceptance alone does not satisfy that dependency.
Use the reference attachment audit to check that each dependent operation binds the intended source. The failed-job guide supports targeted recovery.
Test boundaries before increasing the pool
With mocked requests, record the maximum simultaneous submissions and the dispatch timestamps. Confirm that the pool never exceeds its configured size and the account rate gate still applies when responses return quickly. Inject a slow response, a 429 and a crash after acceptance.
Then inspect durable recovery: successful items stay submitted, uncertain items keep their keys and dependent items remain blocked appropriately. Check the model hub when estimating the batch's separate points budget. Increase client concurrency only when measurements justify it; this design makes resource use controllable without promising more provider capacity or faster completed media.
Related tasks
- After Reordering References, Does “Image 1” Still Point to the Right File?
- What Should You Check Before Retrying a Failed Image or Video Job?
Sources and scope
- Imagild API console: Current request limits, retry handling, authentication and asynchronous task lifecycle.
- Imagild model hub: Current model options and media-generation point costs, separate from request-rate budgets.
- p-limit maintainer documentation: Limiting concurrent asynchronous function execution, distinct from request-rate limiting and provider throughput.
Product instructions were checked against the current Imagild API contract and the public model catalog. Code, budgets and acceptance checks are illustrative; this article does not claim a new paid generation test, an uptime measurement, a search-volume study or a ranking of AI citations.
Prepared by Imagild Editorial, the company editorial team responsible for these guides. AI assisted research and drafting. This is documentation-based guidance with proposed examples, not a claim of hands-on testing or an independent product review. Report a correction.
Cover: Original Imagild product screenshot captured on 28 October 2026; model availability and prices may change. This image is not an API response or a performance benchmark.