diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-07-02 01:01:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-02 01:01:17 +0200 |
commit | 1a747f7020b6888f84ef54d1631f85bf748da868 (patch) | |
tree | 409b97aae1162ff190e0926d8c4e47f20d55aeda /app/lib | |
parent | bc60d794f8411daa3c4c1541fb373309e4c029b6 (diff) |
Fix statsd UDP sockets not being cleaned up in Sidekiq (#11230)
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/sidekiq_error_handler.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/lib/sidekiq_error_handler.rb b/app/lib/sidekiq_error_handler.rb index 23785cf05..8eb6b942d 100644 --- a/app/lib/sidekiq_error_handler.rb +++ b/app/lib/sidekiq_error_handler.rb @@ -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 |