Back to Blog
Laravel 13.35 Scheduler and Queue Worker Changes for Multi-Server Apps
Laravel 13.35 adds Schedule::alwaysOnOneServer(), deploy interrupts that long-running scheduled commands can actually see, and percentage-based queue:work --memory limits. Small changes, real production wins.
Back
Engineering
Table of contents
A lot of Laravel scheduler trouble is not a code bug. It is a scaling bug. One server runs schedule:run fine. Then you add a second replica, or a worker container that also runs the scheduler, and the nightly report goes out twice.
Laravel 13.35.0 (released October 6, 2026) ships three small changes aimed at exactly that stage of an app's life. None of them are flashy. All three remove something a team had to remember by hand.
Quick Answer
Upgrade laravel/framework to 13.35.0 or newer, then:
- If more than one server runs the scheduler, call
Schedule::alwaysOnOneServer()inAppServiceProvider::boot(). Give any scheduled closure aname(), or it will still run everywhere. - If a scheduled command runs for minutes or hours in the background, check
$schedule->hasBeenInterruptedSince($startedAt)between batches soschedule:interruptin your deploy script can stop it at a safe point. - If your queue containers change size, consider
php artisan queue:work --memory=60%instead of a hard-coded megabyte value. Only do this when PHP'smemory_limitis finite.
alwaysOnOneServer(): one switch instead of a policy
Before 13.35, the way to keep every task on one server was to add ->onOneServer() to each task, or wrap the whole schedule in Schedule::onOneServer()->group(...). Both work. Both rely on every future task being added the right way.
Jack Bayliss's PR (#61789) describes the moment that prompted it: adding scheduler replicas and asking why something was being sent 50 times. The fix is a global switch:
php
use Illuminate\Support\Facades\Schedule;
public function boot(): void
{
Schedule::alwaysOnOneServer();
}It is off by default, so nothing changes until you opt in.
Two details matter more than the headline.
First, unnamed closures are skipped. In the 13.35 source, any Schedule::call(...) closure without a description is left alone instead of throwing, and the scheduling docs say it plainly: those closures "will continue to run on every server." If you have a closure that sends email or charges a card, give it a name:
php
Schedule::call(fn () => User::resetApiRequestCount())
->name('reset-api-request-count')
->daily();Second, this is still the normal onOneServer lock. The docs require a shared cache driver (database, memcached, dynamodb, or redis) and every server must talk to the same cache server. If each container has its own file or array cache, the switch does nothing useful. That part has not changed, but a global switch makes it easier to assume you are covered when you are not.
A related PR in the same release (#61798) adds on_one_server to php artisan schedule:list --json. Before, you had to read the schedule code to know which tasks were single-server. Now you can ask the box. In my reading of the 13.35 source, schedule:list goes through the same events() method that applies the global switch, so this is a quick way to confirm it took effect.
schedule:interrupt that long commands can see
schedule:interrupt exists so a deploy can stop an in-progress schedule:run that would otherwise keep running old code until the minute ends. The catch, as PR #61764 explains, was that it never reached commands started with runInBackground(). The interrupt flag was a cache value that expired at the end of the minute. A command that runs for an hour had no way to know a deploy wanted it to stop. So the deploy either waited or killed it halfway.
In 13.35 the interrupt stores a timestamp instead (the same idea queue:restart uses), and the Schedule class gets a method to check it:
php
use Illuminate\Console\Scheduling\Schedule;
public function handle(Schedule $schedule): void
{
$startedAt = now();
foreach ($this->batches() as $batch) {
if ($schedule->hasBeenInterruptedSince($startedAt)) {
return; // the next scheduled run picks up from here
}
$this->process($batch);
}
}One thing to watch: the PR description shows this method as interruptedSince(). The merged code in 13.35.0 calls it hasBeenInterruptedSince(). Follow the code. As of my check, the 13.x scheduling docs do not document the new method yet, so the source is the reference for now.
The method returns false if you turned off interrupt polling with Schedule::withoutInterruptionPolling(). Your deploy script does not change. It still runs php artisan schedule:interrupt after the new code is in place. A side effect worth knowing: an interrupt no longer carries over into a schedule:run that starts later in the same minute.
Laravel still cannot make your command stop safely. You decide where the safe points are. If your command processes one giant query with no batches, there is nowhere to check.
queue:work --memory as a percentage
--memory tells a worker to exit once it has used that many megabytes, so Supervisor (or your container runtime) can start a fresh one. The default is still 128. PR #61753 lets you pass a percentage of PHP's memory_limit instead:
bash
php artisan queue:work --memory=60%The appeal is simple. When you resize a worker container and raise memory_limit, the worker threshold follows. Nobody has to remember to edit the Supervisor config too.
The docs add the important caveat: percentages need a finite memory_limit. If PHP runs with memory_limit = -1, use megabytes. Looking at the merged code, a percentage of an unlimited limit works out to a negative number, and the worker then skips the memory check entirely. That is a quiet failure mode, so check php -i | grep memory_limit inside the actual worker container before switching.
The PR also notes this does not apply to Laravel Cloud managed queues, which do not accept custom worker options.
My take
None of this is a reason to rush an upgrade on its own. It is a reason to take the next 13.x minor with a small checklist:
- Grep your schedule for
Schedule::call(and name every closure that has side effects. - Turn on
alwaysOnOneServer()only after confirming the cache store is shared, then checkschedule:list --json. - Add
hasBeenInterruptedSince()checks to the one or two background commands that actually run long. You probably know which ones already. - Leave
--memoryalone unless your containers get resized often.
My opinion: the global switch is the most useful of the three, mainly because it turns a code review rule into config. The unnamed closure exception is the part I expect people to miss.
As of 20 November 2026, laravel/framework v13.43.0 is the current release on GitHub and Packagist. The scheduler and queue worker changes described here are unchanged in 13.x.
Sources
- Laravel framework v13.35.0 release
- laravel/framework PR #61789 (Schedule::alwaysOnOneServer)
- laravel/framework PR #61798 (on_one_server in schedule:list --json)
- laravel/framework PR #61764 (long-running scheduled commands can see schedule:interrupt)
- laravel/framework PR #61753 (percentages for queue:work --memory)
- Laravel scheduling docs (13.x): Running Tasks on One Server
- Laravel queues docs (13.x): Resource Considerations
Comments
No comments yet
Loading comments...