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

master
Eugen Rochko 5 years ago committed by GitHub
parent bc60d794f8
commit 1a747f7020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/lib/sidekiq_error_handler.rb

@ -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

Loading…
Cancel
Save