spaceship/lib/spaceship/connect_api/api_client.rb in fastlane-2.205.1 vs spaceship/lib/spaceship/connect_api/api_client.rb in fastlane-2.205.2
- old
+ new
@@ -155,12 +155,10 @@
super
end
end
def with_asc_retry(tries = 5, &_block)
- tries = 1 if Object.const_defined?("SpecHelper")
-
response = yield
status = response.status if response
if [500, 504].include?(status)
@@ -168,12 +166,19 @@
raise TimeoutRetryError, msg
end
return response
rescue UnauthorizedAccessError => error
- # Catch unathorized access and re-raising
- # There is no need to try again
- raise error
+ tries -= 1
+ puts(error) if Spaceship::Globals.verbose?
+ if tries.zero?
+ raise error
+ else
+ msg = "Token has expired or has been revoked! Trying to refresh..."
+ puts(msg) if Spaceship::Globals.verbose?
+ @token.refresh!
+ retry
+ end
rescue TimeoutRetryError => error
tries -= 1
puts(error) if Spaceship::Globals.verbose?
if tries.zero?
return response