Fix statsd UDP sockets not being cleaned up in Sidekiq (#11230)

lolsob-rspec
Eugen Rochko 2019-07-02 01:01:17 +02:00 committed by GitHub
parent 227d9297ba
commit 7391d223ab
1 changed files with 5 additions and 3 deletions

View File

@ -3,9 +3,11 @@
class SidekiqErrorHandler
def call(*)
yield
rescue Mastodon::HostValidationError => e
Rails.logger.error "#{e.class}: #{e.message}"
Rails.logger.error e.backtrace.join("\n")
rescue Mastodon::HostValidationError
# Do not retry
ensure
socket = Thread.current[:statsd_socket]
socket&.close
Thread.current[:statsd_socket] = nil
end
end