iqdb: fix 599 timeout errors.

Increase timeout to 30 seconds when uploading files to IQDB. Previously
we used the default timeout of 3 seconds, which could cause 599 timeout
errors sometimes if the upload took too long.
This commit is contained in:
evazion
2020-06-18 00:57:51 -05:00
parent f790a1aeed
commit 459f67c431

View File

@@ -55,7 +55,7 @@ class IqdbProxy
file = HTTP::FormData::File.new(file) if file
form = { file: file, url: url, limit: limit }.compact
response = http.post("#{iqdbs_server}/similar", form: form)
response = http.timeout(30).post("#{iqdbs_server}/similar", form: form)
raise Error, "IQDB error: #{response.status}" if response.status != 200
raise Error, "IQDB error: #{response.parse["error"]}" if response.parse.is_a?(Hash)