Did you tried to dd in the failed method? Is it reached?
[Closed] Redis facade seems to be unavailable in a job's failed() method
Good day y'all. I was trying to handle exceptions generated inside the job's handle method, and since I want to save the exception information in the cache (I'm using Redis with PHPRedis), I tried to use the Redis facade in the job's failed() method, but it seems that the Redis commands are not executed inside that method, even though I am able to dd the Redis connection, which reports the correct server's configuration.
So, something like this:
public function failed(Throwable $e): void {
Redis::set('cacheKey', 'testValue');
}
is not working, as well as getting values from Redis.
EDIT: I tried even with Cache facade, but nothing seems to work. I am executing the queue with the command
php artisan queue:work
What am I missing?
Is it a context problem?
Sorry for the silly questions, but I'm learning Laravel.
Thank you in advance.
Kind regards.
I don't know if this forum has ever been active, but the support I received as a newcomer is equal to zero.
Please or to participate in this conversation.