DEV Community

marius-ciclistu
marius-ciclistu

Posted on • Originally published at marius-ciclistu.Medium on

Maravel-Framework 10.58.0 Cache Lock Refresh and Fail Job On Worker PHP Fatal Errors


Maravel-Framework

In this new minor version:

1. New cache lock refresh (#31)

This will allow the developer to extend the lock period without releasing the lock in long running processes.

2. Block calls from Model to Eloquent Builder from __call but allow from __callStatic (#30) to avoid unwanted behavior like updating all rows from the table:

ExampleModel::findOrFail($id)
    ->tap(fn ($instance) => {
        $instance->name = 'newName';
    })
    ->update(['field' => $value]);
Enter fullscreen mode Exit fullscreen mode

3. Handle memory overflow in jobs by failing them when tries = 0 (#28)

Tries being set to 0 means the job will be retried indefinitely from laravel’s perspective.

SQS from AWS has a default of 3 retries so in that case the jobs will not be retied indefinitely. When a worker processes a message and fails (e.g., crashes, throws an error, or doesn’t delete the message), the message becomes visible again after its visibility timeout expires and can be received again by any consumer. Each subsequent delivery increments the ApproximateReceiveCount. Once this count reaches the maxReceiveCount defined in the redrive policy, SQS moves the message to a dead-letter queue (DLQ) for further inspection or manual handling.

However for Redis this is not the case, leasing to indefinite retries.

The DB driver is not for production usage anyway.

This new feature will launch a background child process from the worker’s process registered shutdown function that will fail the job if tries = 0 applies to that job.

Top comments (0)