Welcome Guest, Not a member yet? Register   Sign In
When Queue Fails
#1

(This post was last modified: 02-13-2025, 05:51 AM by 68thorby68.)

Hi,
Please note my application is hosted on a shared hosting platform.

I am using the Queue package to process 3rd Party Webhooks, and for the most part, the Queue package is working like a dream.

However, if a queued job fails, the Queue class writes the queue data to the queue_jobs_failed table, then seems to just exit.

This is causing problems on the shared hosting platform. As per the documentation I have a CRON job executing the following every 1 minute:
Code:
php spark queue:work myqueuename

Because a failed job will just exit after writing to queue_jobs_failed table and not return the cron, the CRON does not know the job has finished executing and leaves the cron task open on the server. If the issue persists, the servers task queue quickly becomes overloaded as it starts a new cron every minute, then will eventually "crash".

I have implemented an exception handlers, where I can, to return the cron, but was wondering if there are recommendations on how to exit the Queue class (return the cron) if/when the queue fails?

When running the queue I'm considering using the suffix
Code:
--stop-when-empty

But, would the Queue class recognise the queue an empty and return the cron even after the case of a failed queue?

Note: 
I'm not sure about other environments, but if your application is hosted on a shared server and you are implementing Codeigniter Queue Package I would advise that for any development or testing you use the servers cPanel - Terminal (or similar)  to run the queue, rather than cron. That way the servers task queue does not become overloaded if the queue fails.
Reply


Messages In This Thread
When Queue Fails - by 68thorby68 - 02-13-2025, 05:48 AM
RE: When Queue Fails - by michalsn - 02-15-2025, 02:06 PM
RE: When Queue Fails - by 68thorby68 - 02-20-2025, 02:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB