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

This commit is contained in:
Eugen Rochko 2019-07-02 01:01:17 +02:00
parent 5d79df0273
commit 769bbd511f

View file

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