Add exponential backoff for SendFile failures
This commit is contained in:
@@ -1036,19 +1036,21 @@ import okhttp3.HttpUrl;
|
|||||||
|
|
||||||
this.isValidatingJob = true;
|
this.isValidatingJob = true;
|
||||||
int max_try = 3;
|
int max_try = 3;
|
||||||
|
int timeToSleep = 22000;
|
||||||
ServerCode ret = ServerCode.UNKNOWN;
|
ServerCode ret = ServerCode.UNKNOWN;
|
||||||
Type confirmJobReturnCode = Error.Type.OK;
|
Type confirmJobReturnCode = Error.Type.OK;
|
||||||
retryLoop:
|
retryLoop:
|
||||||
for (int nb_try = 0; nb_try < max_try; nb_try++) {
|
for (int nb_try = 0; nb_try < max_try; nb_try++) {
|
||||||
if (nb_try >= 1) {
|
if (nb_try >= 1) {
|
||||||
// sleep before retrying
|
// sleep before retrying
|
||||||
this.log.debug(checkpoint, "Sleep for 32s before trying to re-upload the frame");
|
this.log.debug(checkpoint, "Sleep for " + timeToSleep / 1000 + "s before trying to re-upload the frame");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(32000);
|
Thread.sleep(timeToSleep);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
confirmJobReturnCode = Error.Type.UNKNOWN;
|
confirmJobReturnCode = Error.Type.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
timeToSleep *= 2; // exponential backoff
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = this.server.HTTPSendFile(url_real, ajob.getOutputImagePath(), checkpoint, this.gui);
|
ret = this.server.HTTPSendFile(url_real, ajob.getOutputImagePath(), checkpoint, this.gui);
|
||||||
|
|||||||
Reference in New Issue
Block a user