Skip to the main content
{}
Back to all articles

Technical article

Laravel queues without a permanent worker: safe shared-hosting alternatives

Decide which tasks must remain synchronous and which optional work can use provider callbacks, cron or controlled batches.

By Codegenie2 minute read
  • Deployment & operations
  • Laravel
  • queues
  • permanent
  • worker
  • safe
Queue of tasks between website components and a dashboard.
In this article

A stored queue job does not execute itself. Without a permanent worker, deliberately choose short synchronous work, a permitted bounded consumer or another execution service. Do not report a completed customer action when only a job was scheduled.

Who actually executes the work?

  • sync: execution in the current process; the request waits for the task.
  • Database or another durable queue: storage only; a consumer is still required.
  • Bounded worker through cron: only when PHP CLI, frequency, locks and process limits actually allow it.
  • External service: review delivery guarantees, callbacks and failure handling.

Laravel 13 also documents deferred, which runs after the response in the same process, and background, which starts a PHP process. Neither automatically provides a durable consumed queue on your hosting. Check process permissions and termination behaviour. Do not treat deferred execution as an invisible guarantee for critical work.

Illustration: contact email in a short synchronous flow

Mail processing without assuming a queue consumerapp/Http/Controllers/ContactStoreController.phpphp
Mail::to(config('mail.contact_recipient'))
    ->send(new PublicFormMail($payload));

// Shared hosting baseline:
// QUEUE_CONNECTION=sync

PublicFormMail must not itself implement ShouldQueue in this example. The snippet assumes validated input and a configured recipient. Bound mail transport time and handle failures before showing success. Mail-server acceptance does not prove inbox delivery. An unknown transport outcome can make resending duplicate mail; use an enquiry reference.

A temporary consumer is still a consumer

Laravel offers queue:work --stop-when-empty and --max-time. A time limit is checked between jobs and does not independently bound every blocking network call. Job timeouts need the right runtime conditions. Prevent overlapping cron consumers, bound retries and inspect queue age and failed jobs. If the host cannot support this, the pattern does not fit.

Test transport failure, interruption and repetition with fakes. Long exports or critical asynchronous work may need different hosting or an explicit external executor. This is a functional hosting requirement, not a setting that magically consumes a queue.

Example verification: PHP fragments were syntax-checked with PHP 8.5.11. Laravel execution and hosting behaviour were not tested; use a suitable test application and configuration.

Last updated:

Need technical context for your own project?

Codegenie helps with Laravel applications, existing codebases, shared-hosting deployments and technical improvements.