mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Make global stats processing gracefully handle errors
This commit is contained in:
parent
4fd83bfe7d
commit
99a3194a96
1 changed files with 5 additions and 2 deletions
|
@ -71,10 +71,9 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def ❤(key, json)
|
def ❤(key, json)
|
||||||
|
fails = procd = 0
|
||||||
begin
|
begin
|
||||||
fails = 0
|
|
||||||
Processor::FAILURE.update {|curr| fails = curr; 0 }
|
Processor::FAILURE.update {|curr| fails = curr; 0 }
|
||||||
procd = 0
|
|
||||||
Processor::PROCESSED.update {|curr| procd = curr; 0 }
|
Processor::PROCESSED.update {|curr| procd = curr; 0 }
|
||||||
|
|
||||||
workers_key = "#{key}:workers".freeze
|
workers_key = "#{key}:workers".freeze
|
||||||
|
@ -91,6 +90,7 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
fails = procd = 0
|
||||||
|
|
||||||
_, _, _, msg = Sidekiq.redis do |conn|
|
_, _, _, msg = Sidekiq.redis do |conn|
|
||||||
conn.pipelined do
|
conn.pipelined do
|
||||||
|
@ -111,6 +111,9 @@ module Sidekiq
|
||||||
rescue => e
|
rescue => e
|
||||||
# ignore all redis/network issues
|
# ignore all redis/network issues
|
||||||
logger.error("heartbeat: #{e.message}")
|
logger.error("heartbeat: #{e.message}")
|
||||||
|
# don't lose the counts if there was a network issue
|
||||||
|
PROCESSED.increment(procd)
|
||||||
|
FAILURE.increment(fails)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue