vendredi 24 février 2017

How to manually fail a queue task in Laravel 5?

A bit of a context: I'm building a sync service based on Laravel and PhantomJS that does web automation to sync my data with other party website that includes lot of scripting. I'm using Laravel queues for my sync jobs.

One of the concerns I have is that, since JS is async in nature, I use a while loop to check if something has happened. If at any point, any task runs in to an infinite loop, I want to be able to trigger a task failure.

Here is a bit of code to give some idea:

while ($jQuery !== 'undefined') {
    sleep(1);
    $jQuery = $this->session->evaluateScript("typeof $;");
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire