Skip to content

Commit

Permalink
Improve upload stability by retry upload for any server error (#37)
Browse files Browse the repository at this point in the history
Description
===========

This is my latest attempt to make appcenter more stable. The
developers still fight with a list off issues which results in
random server errors. I will now add another exception to
the retry worthy cases. I only do this for the `releaseID poll` call
since this is the one we always see errors and I don't want to
rewrite the whole plugin. If this will also not yield better
stability I'm inclined to wrap the whole upload in a try catch
and repeat each upload multiple times no matter the error.

Changes
=======

* ![IMPROVE] upload stability by retry upload for any server error
  • Loading branch information
Larusso committed Mar 4, 2021
1 parent c61c535 commit 90d49e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.apache.http.entity.ContentType
import org.apache.http.entity.StringEntity
import wooga.gradle.appcenter.api.AppCenterRest.AppCenterError
import wooga.gradle.appcenter.error.AppCenterAppExtractionException
import wooga.gradle.appcenter.error.AppCenterAppUploadServerErrorException
import wooga.gradle.appcenter.error.AppCenterMalwareDetectionException
import wooga.gradle.appcenter.error.AppCenterUploadException

Expand Down Expand Up @@ -152,6 +153,12 @@ class AppCenterReleaseUploader {
return upload(binary)
}
throw e
} catch (AppCenterAppUploadServerErrorException e) {
if (retryCounter <= 3) {
retryCounter += 1
return upload(binary)
}
throw e
}

Map release = getRelease(releaseId)
Expand Down Expand Up @@ -253,6 +260,8 @@ class AppCenterReleaseUploader {
break
}
break
case 500..600:
throw new AppCenterAppUploadServerErrorException("unable to poll release id of upload ${uploadId} ${owner}/${applicationIdentifier}: server error ${response.toString()}")
default:
onUnhandledResponse("Unable to poll for release id '${uploadId}'", response)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class AppCenterUploadException extends Exception {

@InheritConstructors
class AppCenterAppExtractionException extends Exception {
}

@InheritConstructors
class AppCenterAppUploadServerErrorException extends Exception {
}

@InheritConstructors
Expand Down

0 comments on commit 90d49e1

Please sign in to comment.