Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jobs dont get out the waiting room #11

Open
webattitude opened this issue Nov 23, 2018 · 1 comment
Open

jobs dont get out the waiting room #11

webattitude opened this issue Nov 23, 2018 · 1 comment

Comments

@webattitude
Copy link

some jobs get queued in the waiting room (dont know why BTW), then they never get pulled out...

@hillia
Copy link

hillia commented Jan 13, 2020

It appears there's nothing in this plugin that requeues jobs in the waiting_room by default. You'll need to implement something yourself.

I used the following job on a 5 minute schedule:

# Works through contents of :waiting_room queue and requeues them in their original queue.
class RequeueWaitingRoomJobs
    @queue = :urgent

    def self.perform
        # Only process jobs currently in queue, in case we end up requeueing some of them.
        queue_length = Resque.size(:waiting_room)
        queue_length.times do
            job = Resque.reserve(:waiting_room)

            # If the job is not ready to leave the waiting room, Job#reserve will requeue it to waiting_room and return nil.
            next if job.nil?

            # Requeue to original queue.
            Resque.enqueue(job.payload_class, *job.args)
        end
    end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants