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

use enqueue instead of retry_job to reenqueue jobs #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/job-iteration/iteration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ def perform(*params) # @private
interruptible_perform(*params)
end

def retry_job(*)
super unless defined?(@retried) && @retried
@retried = true
end

private

def enumerator_builder
Expand Down Expand Up @@ -150,7 +145,9 @@ def reenqueue_iteration_job
self.times_interrupted += 1

self.already_in_queue = true if respond_to?(:already_in_queue=)
retry_job

enqueue unless @enqueued
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You no-op enqueueing if @enqueued is set, but what about the rest of side-effects in that method? Why do they need to run if the job was already enqueued?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm missing something you need the defined?(@enqueued) otherwise you will get a Ruby warning.

@enqueued = true
end

def adjust_total_time
Expand Down