Revision 0ab14da1
Added by Adam Ruzicka over 1 year ago
extras/dynflow-sidekiq.rb | ||
---|---|---|
require "sidekiq/sd_notify"
|
||
|
||
rails_root = Dir.pwd
|
||
|
||
app_file = File.expand_path('./config/application', rails_root)
|
||
... | ... | |
Sidekiq.options[:dynflow_world] = world
|
||
end
|
||
|
||
# To be able to ensure ordering, dynflow requires that there is only one
|
||
# orchestrator active at the same time.
|
||
# This is enforced by orchestrators contending a lock in redis, calls to
|
||
# dynflow.initialize! block until the lock is acquired by the current process.
|
||
# To play nice with sd_notify, we need to mark the process as ready before it
|
||
# attempts to acquire the lock.
|
||
if Sidekiq.options[:dynflow_executor]
|
||
Sidekiq::SdNotify.ready
|
||
Sidekiq::SdNotify.status('orchestrator in passive mode')
|
||
end
|
||
::Rails.application.dynflow.initialize!
|
||
Rails.logger.info("Everything ready for world: #{::Rails.application.dynflow.world.id}")
|
||
msg = "Everything ready for world: #{::Rails.application.dynflow.world.id}"
|
||
Rails.logger.info(msg)
|
||
Sidekiq::SdNotify.status(msg)
|
Also available in: Unified diff
Refs #35414 - Fix sd_notify for multiple orchestrators