-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
Add delay option into Shoryuken.add_group #543
Add delay option into Shoryuken.add_group #543
Conversation
pizza-planet
commented
Dec 12, 2018
•
edited by phstc
Loading
edited by phstc
- 👋 Hey Pablo! Thanks for all your work on Shoryuken. 😄
- Fixes Delay cannot be set per processing group #454
@lucas-ibotta yay that's great! Thank you. Sorry for the delay to get back to you, I will have a look to this this week and merge it down! |
Sounds great. Let me know about |
EDIT: found the issue with the delay tests and refactored it a bit. |
Cool. Tests are passing now. Just code climate remains. |
@lucas-ibotta thanks. I will test it locally to see how it goes. Don't worry about these two feedback from Code Climate - it is fine. |
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.
@lucas-ibotta it is looking good, I just left a few minor comments, can you 👀?
BTW did you have a chance to test it locally?
Yes, nice catch. I have been on holiday, but I'll address those points soon and test things out locally. 👌 |
…ucas-ibotta/shoryuken into feature/add_delay_into_group_interface
@@ -57,10 +57,8 @@ def ==(other) | |||
end | |||
end | |||
|
|||
private |
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.
I made delay
public and wrote some tests for it on each polling strategy.
Testing this locally and working out some of the bugs. |
it 'sets delay based on group' do | ||
delay_polling = Shoryuken::Polling::StrictPriority.new(queues, 25) | ||
expect(delay_polling.send(:delay)).to eq(25.0) | ||
expect(subject.send(:delay)).to eq(1.0) |
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.
I can't track down where this is a 1.0
instead of a 0.0
.
Ok, I tested this locally with # in setup_shoryuken.rb
Shoryuken.configure_server do |config|
Shoryuken.add_group('no-delay', 5)
Shoryuken.add_queue("https://sqs.us-east-1.amazonaws.com/../normal-queue", 5, 'no-delay')
Shoryuken.add_group('delay', 5, delay: 25)
Shoryuken.add_queue("https://sqs.us-east-1.amazonaws.com/../delay-queue", 5, 'delay')
end
class DelayWorker
include Shoryuken::Worker
shoryuken_options queue: 'https://sqs.us-east-1.amazonaws.com/../delay-queue'
def perform(_sqs_message, body)
puts "DelayWorker Called with #{body}"
end
end
class NormalWorker
include Shoryuken::Worker
shoryuken_options queue: 'https://sqs.us-east-1.amazonaws.com/../normal-queue'
def perform(_sqs_message, body)
puts "NormalWorker Called with #{body}"
end
end Then ran You should probably also test from this branch to confirm? |
Excellent. Thanks! Happy New Year to you too. |