-
Notifications
You must be signed in to change notification settings - Fork 118
Add :stack to Job::Queue #365
base: master
Are you sure you want to change the base?
Conversation
@queues ||= Array(Travis.config.queues).compact.map do |queue| | ||
Queue.new(*queue.values_at(*[:queue, :slug, :owner, :language, :os])) | ||
end | ||
queues.detect { |queue| queue.send(:matches?, config) } || default |
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.
Why not just queue.matches?(config)
?
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.
For some reason all the instance methods are private, not sure why
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.
@henrikhodne made it public
@queues ||= Array(Travis.config.queues).compact.map do |queue| | ||
Queue.new(*queue.values_at(*[:queue, :slug, :owner, :language, :os])) | ||
end | ||
queues.detect { |queue| queue.matches?(config) } || default |
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 think this is fine as it is, but here's a Ruby tip of the day: Enumerable#detect
takes an argument that's used if nothing matches, so this could be written as:
queues.detect(default) { |queue| queue.matches?(config) }
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.
nice one, will use that
Can we merge this? :) |
Added a feature flag for this (per owner) and tested on staging. |
Can you explain how |
@joshk during beta we whitelist repo owners using a feature flag. people can then opt in to using docker by setting All of The reason to pick |
I have also refactored Job::Queue a little bit to remove all the repetition in
matches_something?
that we've had.