Last active
August 18, 2021 09:55
-
-
Save brenes/054da72418c150f504e7b01928f82abe to your computer and use it in GitHub Desktop.
Sidekiq configuration pero host type (AWS TAG)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk' | |
Sidekiq.configure_server do |config| | |
#..... | |
ec2 = Aws::EC2::Resource.new(region: 'eu-west-1') | |
# we build the name if the instance, based on the hostname | |
i = ec2.instance(Socket.gethostname.gsub(/^[^-]*-/, '')) | |
# we get its tags and check if it's the desired one | |
if i.tags.map(&:value).includes('priority-batch') | |
Sidekiq.options[:queues] = Settings.priority_queues | |
else | |
Sidekiq.options[:queues] = Settings.not_priority_queues | |
end | |
#..... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment