]> cat aescling's git repositories - mastodon.git/commitdiff
Fix statsd UDP sockets not being cleaned up in Sidekiq (#11230)
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 1 Jul 2019 23:01:17 +0000 (01:01 +0200)
committerGitHub <noreply@github.com>
Mon, 1 Jul 2019 23:01:17 +0000 (01:01 +0200)
app/lib/sidekiq_error_handler.rb

index 23785cf055837cfca43beb24594ef32a73ea716e..8eb6b942dba17302880dcb87fd490652e14bc813 100644 (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