-
Notifications
You must be signed in to change notification settings - Fork 308
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
Version 1.0.0 seems to be ignoring the sidekiq_role
that is set.
#191
Comments
It is because This should have been documented in the CHANGELOG as a breaking change. |
Sounds good. Should it be added to the changelog as a breaking change now for people that haven't upgraded? |
This was pretty painful for me to find and fix. A deprecation warning or something would have been appreciated.... |
Despite changing that it still does not work :/ Sidekiq actions are not running at all for deployment flow... |
Guys any news on that one? I could help if needed |
Mine works fine. Do you set the role on the server properly? |
The same is happening to me. Other gems recognize my roles just fine, but this one is not recognizing them, which turns out to be a nightmare since the process number is not interpreted correctly. @Looooong I'm defining the roles using the server-based syntax, are you doing it in a different way by any chance? |
I use Capistrano 3.10.1 and Capistrano Sidekiq 1.0.0. Here is how I config the Sidekiq: set :sidekiq_roles, :sidekiq
set :sidekiq_config, -> { File.join(current_path, 'config', 'sidekiq.yml') }
server 'host', user: fetch(:user), roles: %w[app migration sidekiq], primary: true |
@Looooong yeah I'm using the exact same versions. I believe the issue only occurs when there is more than one role (I control the number of sidekiq processes based on the role by using |
@jsantos same here - exactly the same case. |
You guys should take a look at sidekiq.rake:142 to see if there is any problem with the code. I don't see any problem with it, perhaps you can. |
Guess I've found the issue. After much debugging I figured out the issue lies exactly where @Looooong pointed out. The Example: set :sidekiq_pid, File.join(shared_path, 'tmp', 'pids', 'sidekiq.pid')
set :sidekiq_roles, [:master, :slave]
set :master_processes, 1
set :slave_processes, 2
# On the first host (host.roles = [:master]):
> pid_files
[
[0] "app/shared/tmp/pids/sidekiq-0.pid"
]
# On the second host (roles = [:slave]):
> pid_files
[] Without mutating the # On the first host (host.roles = [:master]):
> pid_files
[
[0] "app/shared/tmp/pids/sidekiq-0.pid"
]
# On the second host (roles = [:slave]):
> pid_files
[
[0] "app/shared/tmp/pids/sidekiq-0.pid",
[1] "app/shared/tmp/pids/sidekiq-1.pid"
] Since the method is used every time we call So on this line, we should use: sidekiq_roles = sidekiq_roles.select { |role| host_roles.include?(role) } To avoid the mutation of I'll issue a PR to fix this. |
Good finding there! I have never thought that |
@Looooong Yeah, that's why it took so long to debug. For reference: [1] pry(main)> sidekiq_roles = [:master, :slave]
[
[0] :master,
[1] :slave
]
[2] pry(main)> roles = Array(sidekiq_roles)
[
[0] :master,
[1] :slave
]
[3] pry(main)> roles.select! {|r| r == :master}
[
[0] :master
]
[4] pry(main)> roles
[
[0] :master
]
[5] pry(main)> sidekiq_roles
[
[0] :master
]
`` |
@jsantos any chance on releasing 1.0.1? |
After upgrading from
0.20.0
to1.0.0
, Sidekiq is now being started on all of our app servers, regardless of the role set. Downgrading to0.20.0
fixes it so that it only starts Sidekiq on the server that has that role specified.Our configuration is as follows:
config/deploy.rb
set :sidekiq_role, :worker
config/deploy/production.rb
Thanks in advance.
The text was updated successfully, but these errors were encountered: