Sidekiq worker details even for inactive workers

4 views
Skip to first unread message

Pranav Dubey

unread,
Dec 5, 2023, 5:28:43 AM12/5/23
to Sidekiq
Hi all,

I have a usecase wherein I want to make scheduling decisions off of the sidekiq processes and the workers(threads ) in each of them. The way I'm doing it (from elixir code) is:
{:ok, workers} = Mozek.Redis.command(["SMEMBERS", "processes"]) Enum.reduce(workers, 0, fn worker, acc ->
{_, payload} = Mozek.Redis.command(["HGETALL", "#{worker}:workers"])
acc + div(length(payload), 2)
end)

This is working fine as long as workers are working but is not useful if workers are idle in which case the first and second queries don't give the expected result. Can someone point out what am I doing wrong or what else can I do to get the same results?

Thanks and regards,
Pranav Dubey
Reply all
Reply to author
Forward
0 new messages