Description
I am sporadically getting the following error when my sidekiq process is being terminated.
gems/statsig-1.25.2/lib/statsig.rb:238:in 'ensure_initialized': Must call initialize first. (Statsig::UninitializedError)
From my reading of sidekiq documentation, the :shutdown
hook is executed after a SIGTERM is received which means sidekiq stops accepting new work and tries to finish any in flight work before the provided timeout is reached.
Given your example in the docs:
Sidekiq.configure_server do |config|
config.on(:startup) do
Statsig.initialize
end
config.on(:shutdown) do
Statsig.shutdown
end
end
What I'm guessing is happening here is that SIGTERM
is issued, Statsig.shutdown
is executed and inflight jobs are then trying to access statsig?
Anyway wanted to get your opinion on this and ask whether the shutdown is really needed because it doesn't seem like sidekiq provides a hook when all jobs are done or pushed back to redis?