Skip to content

Commit 4f3c370

Browse files
authored
Fix statsd UDP sockets not being cleaned up in Sidekiq (mastodon#11230)
1 parent e6b8709 commit 4f3c370

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

app/lib/sidekiq_error_handler.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
class SidekiqErrorHandler
44
def call(*)
55
yield
6-
rescue Mastodon::HostValidationError => e
7-
Rails.logger.error "#{e.class}: #{e.message}"
8-
Rails.logger.error e.backtrace.join("\n")
6+
rescue Mastodon::HostValidationError
97
# Do not retry
8+
ensure
9+
socket = Thread.current[:statsd_socket]
10+
socket&.close
11+
Thread.current[:statsd_socket] = nil
1012
end
1113
end

0 commit comments

Comments
 (0)