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.
This commit is contained in:
parent
4e71b104e6
commit
54b273bf99
15 changed files with 134 additions and 127 deletions
|
@ -12,11 +12,9 @@ class SendInteractionService < BaseService
|
|||
|
||||
return if !target_account.ostatus? || block_notification?
|
||||
|
||||
delivery = build_request.perform
|
||||
|
||||
raise Mastodon::UnexpectedResponseError, delivery unless delivery.code > 199 && delivery.code < 300
|
||||
|
||||
delivery.connection&.close
|
||||
build_request.perform do |delivery|
|
||||
raise Mastodon::UnexpectedResponseError, delivery unless delivery.code > 199 && delivery.code < 300
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue