Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Prevent to exec a job before finish other #83

Open
swim89 opened this issue Apr 27, 2019 · 0 comments
Open

Prevent to exec a job before finish other #83

swim89 opened this issue Apr 27, 2019 · 0 comments

Comments

@swim89
Copy link

swim89 commented Apr 27, 2019

Hi to everyone,
I have a problem using this library. I know that it can help me to exec jobs without waiting the others ends.

But sometimes I need to wait. For example, I put Job1 into queue "memberships" and after I put Job2 into the same queue.
Into the handle of Job2 I put a code that check if there are other jobs in the DB table, if yes, I use the release method to put it again in queue.
The problem is that if the Job1 finishes it execution, the Job2 doesn't starts...

Here my code:

    $result = DB::table("jobs")->where("queue", "=", "memberships")->where("payload", "NOT LIKE", "%ApiMemberships%");        
    
    $count = $result->count();        
    \Log::debug("Jobs: " . $count);
    if ($count >= 1) {
        \Log::debug("Try again in 1min.");
        $this->release(60);
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant