increase timeout for pixiv api connections
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
require 'resolv-replace'
|
||||||
|
|
||||||
class PixivApiClient
|
class PixivApiClient
|
||||||
API_VERSION = "1"
|
API_VERSION = "1"
|
||||||
CLIENT_ID = "bYGKuGVw91e0NMfPGp44euvGt59s"
|
CLIENT_ID = "bYGKuGVw91e0NMfPGp44euvGt59s"
|
||||||
@@ -171,7 +173,7 @@ class PixivApiClient
|
|||||||
}
|
}
|
||||||
url = "https://oauth.secure.pixiv.net/auth/token"
|
url = "https://oauth.secure.pixiv.net/auth/token"
|
||||||
|
|
||||||
resp = HTTParty.post(url, Danbooru.config.httparty_options.deep_merge(body: params, headers: headers))
|
resp = HTTParty.post(url, Danbooru.config.httparty_options.deep_merge(timeout: 20, body: params, headers: headers))
|
||||||
body = resp.body.force_encoding("utf-8")
|
body = resp.body.force_encoding("utf-8")
|
||||||
|
|
||||||
if resp.success?
|
if resp.success?
|
||||||
|
|||||||
@@ -42,12 +42,14 @@ if Rails.env.test?
|
|||||||
|
|
||||||
# Pass on the error if we've tried too many times.
|
# Pass on the error if we've tried too many times.
|
||||||
if retry_count >= MAX_RESET_RETRIES
|
if retry_count >= MAX_RESET_RETRIES
|
||||||
puts "**** WARN: Mechanize retried connection reset #{MAX_RESET_RETRIES} times and never succeeded: #{action}"
|
print "R"
|
||||||
|
#puts "**** WARN: Mechanize retried connection reset #{MAX_RESET_RETRIES} times and never succeeded: #{action}"
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|
||||||
# Otherwise, shutdown the persistent HTTP connection and try again.
|
# Otherwise, shutdown the persistent HTTP connection and try again.
|
||||||
puts "**** WARN: Mechanize retrying connection reset error: #{action}"
|
print "R"
|
||||||
|
#puts "**** WARN: Mechanize retrying connection reset error: #{action}"
|
||||||
retry_count += 1
|
retry_count += 1
|
||||||
self.http.shutdown
|
self.http.shutdown
|
||||||
retry
|
retry
|
||||||
|
|||||||
Reference in New Issue
Block a user