-
Notifications
You must be signed in to change notification settings - Fork 0
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
enqueue-multi compatibility fixes #1
Changes from all commits
172bc76
3823230
e911f4a
b2f6f24
5a598f3
ec90b99
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,5 @@ nbproject | |
.env | ||
.env.* | ||
/nul | ||
vendor/ | ||
vendor/ | ||
.vscode |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
inherit_from: .rubocop_todo.yml | ||
|
||
AllCops: | ||
SuggestExtensions: false | ||
TargetRubyVersion: 3.0 | ||
NewCops: enable | ||
Include: | ||
- Gemfile | ||
- '**/Rakefile' | ||
- resque-scheduler.gemspec | ||
- bin/resque-scheduler | ||
|
||
Documentation: | ||
Gemspec/DevelopmentDependencies: | ||
Enabled: false | ||
Metrics/ClassLength: | ||
Max: 110 | ||
Metrics/PerceivedComplexity: | ||
Enabled: false | ||
Naming/HeredocDelimiterNaming: | ||
Enabled: false | ||
|
||
Style/DoubleNegation: | ||
Enabled: false | ||
Metrics/PerceivedComplexity: | ||
Style/FrozenStringLiteralComment: | ||
Enabled: false | ||
Metrics/ClassLength: | ||
Max: 110 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,25 +204,36 @@ def enqueue_next_item(timestamp) | |
item | ||
end | ||
|
||
def batch_delayed_items? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This starts the refactor that revives the 'non batched' mode by deciding if batching is appropriate |
||
!disable_delayed_requeue_batches && delayed_requeue_batch_size > 1 | ||
end | ||
|
||
# Enqueues all delayed jobs for a timestamp | ||
def enqueue_delayed_items_for_timestamp(timestamp) | ||
count = 0 | ||
batch_size = delayed_requeue_batch_size | ||
actual_batch_size = nil | ||
batch_size = batch_delayed_items? ? delayed_requeue_batch_size : 1 | ||
|
||
log "Processing delayed items for timestamp #{timestamp}, in batches of #{batch_size}" | ||
message = "Processing delayed items for timestamp #{timestamp}" | ||
message += ", in batches of #{batch_size}" if batch_delayed_items? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. log messages are updated to reflect batching |
||
log message | ||
|
||
loop do | ||
actual_batch_size = 0 | ||
|
||
handle_shutdown do | ||
# Continually check that it is still the master | ||
if am_master | ||
actual_batch_size = enqueue_items_in_batch_for_timestamp(timestamp, | ||
batch_size) | ||
if batch_delayed_items? | ||
actual_batch_size = enqueue_items_in_batch_for_timestamp(timestamp, batch_size) | ||
log "queued batch of #{actual_batch_size} jobs" if actual_batch_size != -1 | ||
else | ||
item = enqueue_next_item(timestamp) | ||
actual_batch_size = item.nil? ? 0 : 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. non batched version |
||
end | ||
end | ||
end | ||
|
||
count += actual_batch_size | ||
log "queued #{count} jobs" if actual_batch_size != -1 | ||
|
||
# continue processing until there are no more items in this | ||
# timestamp. If we don't have a full batch, this is the last one. | ||
|
@@ -231,7 +242,7 @@ def enqueue_delayed_items_for_timestamp(timestamp) | |
break if actual_batch_size < batch_size | ||
end | ||
|
||
log "finished queueing #{count} total jobs for timestamp #{timestamp}" if count != -1 | ||
log "finished queueing #{count} total jobs for timestamp #{timestamp}" | ||
end | ||
|
||
def timestamp_key(timestamp) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Resque | ||
module Scheduler | ||
VERSION = '4.10.2'.freeze | ||
VERSION = '5.11.0'.freeze | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to later released ruby