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

Ability to set a different configuration file per role. #209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lustercr
Copy link

Added role as a parameter of the start method, it will try to check if there was a specific config set for the given role using the convention #{role_name}_config otherwise will check the default :sidekiq_config.

it brings the capability to have different roles processing a separated set of queues from the config. i use this so I can isolate heavier queues such exports on their own infrastructure.

I hope this makes sense to be in the core.

lustercr added 2 commits June 29, 2018 12:01
Added role as parameter of start method, it will try to check if there was an specific config set for the given role using the convention #{role_name}_config otherwise will check the default :sidekiq_config.

it brings the capability to have different roles processing a separated set of queues from the config. i use this so i can isolate heavier queues such exports on their own infrastructure.
@@ -276,4 +277,10 @@ namespace :sidekiq do
properties.fetch(:run_as) || # global property across multiple capistrano gems
role.user
end

def sidekiq_config(role)
sidekiq_roles = Array.wrap(fetch(:sidekiq_roles)) || []

Choose a reason for hiding this comment

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

.wrap is rails specific API, won't be working for non Rails App.

On top of that, || [] is redundant.

Array(fetch(:sidekiq_roles)) would be enough.

@faizalzakaria
Copy link

@lustercr , this is broken with monit enabled.

You can test it out as such;

# Capfile
..
..
require 'capistrano/sidekiq'
require 'capistrano/sidekiq/monit'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants