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

Prevent to exec a job before finish other #83

Open
@swim89

Description

@swim89

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);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions