Close http clients after using

The crystal http client maintains a keepalive connection to the other
server which stays alive for some time. This should be closed if the
client instance is not used again to avoid hogging resources
This commit is contained in:
Andrew Zhao 2020-12-23 00:52:23 -05:00
parent eeeecf9763
commit e0d25ff887
6 changed files with 30 additions and 11 deletions

View file

@ -91,6 +91,8 @@ class Invidious::Jobs::BypassCaptchaJob < Invidious::Jobs::BaseJob
},
}.to_json).body)
captcha_client.close
raise response["error"].as_s if response["error"]?
task_id = response["taskId"].as_i