
Configure Laravel queue retries around a persisted Imagild operation, so every delivery of the same job uses the same idempotency key and exact generation body. Align the HTTP timeout, worker timeout and queue retry window; do not let a worker restart silently create another paid generation.
The Laravel 13 queue documentation distinguishes worker timeout from retry_after. The Imagild API console supplies the separate provider task and idempotency contract.
Key Takeaways
- Put the logical operation ID in the queue message, not a newly generated provider key.
- Keep the worker timeout shorter than the applicable queue retry window.
- Treat a failed queue attempt as a local execution problem until the provider outcome is known.
Set a hierarchy of local limits
For a Redis or database queue, an example policy might use a twenty-second outbound HTTP limit, a sixty-second worker limit and a ninety-second retry_after. These are deployment examples, not a model completion estimate.
Laravel documents that worker timeout should be several seconds shorter than retry_after, helping avoid another worker retrying a job that has not stopped yet. Amazon SQS uses its own visibility timeout instead of this queue setting. Check the worker's required PHP extensions and your process supervisor too.
Do not keep one job sleeping until a long video completes. Submit once, persist the remote task ID, then schedule later short reconciliation jobs.
Store identity before dispatching
The operation row should hold the application owner, frozen request payload, stable idempotency key and optional provider task ID. Queue messages can carry that row's primary key.
Before submission, claim the operation using your database coordination policy. If a previous attempt already stored a task ID, skip the generation POST and inspect that task instead.
This submission fragment uses Laravel's HTTP client as a raw transport, not an Imagild SDK. The operation and secret lookup are application code you implement.
use Illuminate\Support\Facades\Http;
$response = Http::asJson()
->withToken(config('services.imagild.key'))
->withHeaders([
'Idempotency-Key' => $operation->idempotency_key,
])
->connectTimeout(5)
->timeout(20)
->post(
'https://imagild.com/api/relay/v1/images/generations',
$operation->request_payload
);
if ($response->status() !== 202) {
throw new RuntimeException(
'Submission HTTP '.$response->status()
);
}
$taskId = $response->json('data.id');
// Validate the returned UUID and persist it on this operation.
The saved image payload contains supported model, prompt, resolution and an optional owned reference selector. It does not contain local queue names, a callback URL, kind or caller-selected point prices.
Make retry classification explicit
Laravel's HTTP client reference documents connection and request timeouts. If a network interruption obscures a POST outcome, preserve the original operation key and body. A future delivery can recover that same identity.
Do not blindly retry a permanent validation or membership error on every worker attempt. Classify safe error codes in your actual job handler and move corrective cases to review. Sanitize logs rather than dumping request headers.
If you deliberately add transport-level retry calls, ensure every attempt retains the same operation identity and obeys rate-limit pauses. Stacking HTTP retries and queue retries without coordination can amplify traffic even when task identity prevents duplicate logical submissions.
Reconcile task state independently
A subsequent GET /tasks/{id} can return HTTP 200 with a failed task record. Read data.status, data.error and data.usage.state. An unknown result needs reconciliation, not a new task under a different key.
Active membership is required for all API calls, while generation uses account points. The points guide helps distinguish a separately approved retake from retrying the worker.
Test duplicate delivery and interrupted acceptance
Using local fixtures, deliver the same operation twice and verify one stable key. Stop a worker after the provider accepts but before task-ID persistence; recover the original request without changing parameters.
Then test an already saved task ID and ensure the next job performs only a read. Use the failed-job checklist for operator messages. A queue's “failed” marker must not become an unsupported claim that the remote media was cancelled or refunded.
Related tasks
- Imagild Points, Resolution and Jobs: Plan a Creation Before You Spend
- What Should You Check Before Retrying a Failed Image or Video Job?
Sources and scope
- Imagild API console: Active-member access, supported media request fields, idempotency, asynchronous task records and authenticated downloads; checked against the 2026-10-28 relay contract.
- Laravel 13 queues: Worker timeout should be shorter than retry_after; SQS uses visibility timeout, and worker execution limits do not determine remote media outcomes.
- Laravel 13 HTTP client: Bearer header, JSON requests, connection/request timeouts and transport retries used in the illustrative submission fragment.
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.