diff options
author | Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp> | 2018-03-24 20:49:54 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-03-24 12:49:54 +0100 |
commit | 54b273bf993888cd079113dd588cb7a90228b93b (patch) | |
tree | d6437a702618c9108ffad35a540a222a053b2c7d /app/services/unsubscribe_service.rb | |
parent | 4e71b104e6d5f02069120c7a56b26888c6f0fef5 (diff) |
Close http connection in perform method of Request class (#6889)
HTTP connections must be explicitly closed in many cases, and letting perform method close connections makes its callers less redundant and prevent them from forgetting to close connections.
Diffstat (limited to 'app/services/unsubscribe_service.rb')
-rw-r--r-- | app/services/unsubscribe_service.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/services/unsubscribe_service.rb b/app/services/unsubscribe_service.rb index 01f5c6b7a..95c1fb4fc 100644 --- a/app/services/unsubscribe_service.rb +++ b/app/services/unsubscribe_service.rb @@ -7,10 +7,9 @@ class UnsubscribeService < BaseService @account = account begin - @response = build_request.perform - - Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{@response.status}" unless @response.status.success? - @response.connection&.close + build_request.perform do |response| + Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{response.status}" unless response.status.success? + end rescue HTTP::Error, OpenSSL::SSL::SSLError => e Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{e}" end |