Durable Workflow 2.43.0 keeps a resume point for long-running activities
Acknowledged heartbeat checkpoints let long Laravel activities resume with saved context after a retry or worker restart.
A worker restart should not force a full restart
In a homelab, jobs tend to outlive the neat assumptions made when they were first written. A photo import, NAS-to-NAS copy, remote sync, or transcode can still be running when a container is restarted, an app is deployed, or a queue worker hits its timeout. Repeating the CPU work is annoying, but losing track of what already happened on another system is the bigger issue.
Durable Workflow 2.43.0 adds acknowledged heartbeat checkpoints for queued embedded V2 activities. An activity can persist resume data, and a later attempt can receive that state when it needs to continue. The call is only acknowledged after the checkpoint has been committed to storage, so the application does not need the original process to remain alive afterwards. (github.com)
Keep the smallest useful piece of state
The useful pattern is to save only the state needed to carry on: an API cursor, the last copied file, a remote identifier, or a small record of completed work. On a later attempt, lastHeartbeatCheckpoint() returns the checkpoint from an earlier attempt, or null when there is nothing to resume from. (raw.githubusercontent.com)
Here is the shape I would use for an activity that walks through pages from a remote API. The remote client and storage calls belong to the application, while the Durable Workflow calls are the part that provides the recovery boundary. I would write a checkpoint only after the external work for that page has actually finished.
<?php
use Workflow\V2\Activity;
final class SyncRemoteFolder extends Activity
{
public function handle(): void
{
$checkpoint = $this->lastHeartbeatCheckpoint();
$cursor = $checkpoint?->details()['cursor'] ?? null;
do {
$page = $this->remoteFolder->listFiles($cursor);
foreach ($page->files as $file) {
$this->copyFileToLocalStorage($file);
}
$cursor = $page->nextCursor;
$this->heartbeatCheckpoint([
'cursor' => $cursor,
]);
} while ($cursor !== null);
}
}heartbeatCheckpoint() takes a JSON-compatible array and renews the heartbeat when it saves the state. The returned checkpoint object provides details(), along with the acknowledgement time and contract version. The snapshot received by an attempt remains unchanged for that attempt, even if the activity writes newer checkpoints later on. (raw.githubusercontent.com)
Run migrations before bringing up updated workers
This release ships with two package migrations, and they need to be applied before updated workers start processing jobs. One adds checkpoint storage to activity executions, while another adds timeout-cleanup information to run summaries. With Horizon, systemd, Docker Compose, or a Proxmox-managed service, the safe order is to migrate first and restart consumers afterwards. (github.com)
The Laravel command itself is the standard one. There is no new configuration switch required to enable this storage, but the database schema must already include the columns introduced by the release. I would drain or stop workers during the update instead of letting new code run against a database that has not been migrated yet.
php artisan migrate
php artisan queue:workThe checkpoint migration adds a nullable last_heartbeat_checkpoint column to activity_executions. If retained checkpoints still exist, the package refuses to remove that column during rollback. That is the right default: rolling back application code should not quietly destroy the state an activity may need to resume. (raw.githubusercontent.com)
What this does not solve
This feature does not turn an external API call into a distributed transaction. A remote operation may finish just before the process fails, leaving the next attempt uncertain about whether it should repeat the action. For anything that creates a resource, charges money, copies data, or sends a request with side effects, I would still use stable idempotency keys with the external provider. (github.com)
It is also not a replacement for ordinary heartbeat() progress reporting. The existing heartbeat remains useful for operations and visibility, while checkpoints preserve the application context required for recovery. I would avoid putting large payloads or unconsidered sensitive data there, because checkpoint state follows activity-execution retention. (github.com)
Finally, the API applies to queued embedded V2 activities where the resume contract is available. In an unsupported context it throws ActivityHeartbeatResumeUnavailable, and it cannot acknowledge a checkpoint from inside an active workflow-storage transaction. For short jobs, fully local tasks, or work that is already trivial to repeat, this may add more moving parts than value. (raw.githubusercontent.com)
For me, this is most useful on services that rely on local disks, home networks, and external APIs that are not always perfectly predictable. It does not remove the need for idempotent design and careful retries, but it gives the next attempt concrete context instead of making it start blind. That matters when a job has been running for hours and fails near the end.
Source: Laravel Blog Official documentation and release notes