fix: a ghost project is created when a job upload fails (#222)
This commit is contained in:
@@ -463,7 +463,7 @@ public class Client {
|
|||||||
int step = log.newCheckPoint();
|
int step = log.newCheckPoint();
|
||||||
Error.Type ret;
|
Error.Type ret;
|
||||||
while (true) {
|
while (true) {
|
||||||
Job job_to_send;
|
Job job_to_send = null;
|
||||||
try {
|
try {
|
||||||
job_to_send = jobsToValidate.take();
|
job_to_send = jobsToValidate.take();
|
||||||
this.log.debug("will validate " + job_to_send);
|
this.log.debug("will validate " + job_to_send);
|
||||||
@@ -474,13 +474,17 @@ public class Client {
|
|||||||
this.log.debug("Client::senderLoop confirm failed, ret: " + ret);
|
this.log.debug("Client::senderLoop confirm failed, ret: " + ret);
|
||||||
sendError(step);
|
sendError(step);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.uploadQueueSize--;
|
|
||||||
this.uploadQueueVolume -= job_to_send.getOutputImageSize();
|
|
||||||
this.gui.displayUploadQueueStats(this.uploadQueueSize, this.uploadQueueVolume);
|
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
this.uploadQueueSize--;
|
||||||
|
if (job_to_send != null) {
|
||||||
|
this.uploadQueueVolume -= job_to_send.getOutputImageSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.gui.displayUploadQueueStats(this.uploadQueueSize, this.uploadQueueVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,21 +788,23 @@ public class Client {
|
|||||||
int nb_try = 1;
|
int nb_try = 1;
|
||||||
int max_try = 3;
|
int max_try = 3;
|
||||||
ServerCode ret = ServerCode.UNKNOWN;
|
ServerCode ret = ServerCode.UNKNOWN;
|
||||||
while (nb_try < max_try && ret != ServerCode.OK) {
|
Type confirmJobReturnCode = Error.Type.OK;
|
||||||
|
retryLoop: while (nb_try < max_try && ret != ServerCode.OK) {
|
||||||
ret = this.server.HTTPSendFile(url_real, ajob.getOutputImagePath());
|
ret = this.server.HTTPSendFile(url_real, ajob.getOutputImagePath());
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case OK:
|
case OK:
|
||||||
// no issue, exit the loop
|
// no issue, exit the loop
|
||||||
nb_try = max_try;
|
break retryLoop;
|
||||||
break;
|
|
||||||
|
|
||||||
case JOB_VALIDATION_ERROR_SESSION_DISABLED:
|
case JOB_VALIDATION_ERROR_SESSION_DISABLED:
|
||||||
case JOB_VALIDATION_ERROR_BROKEN_MACHINE:
|
case JOB_VALIDATION_ERROR_BROKEN_MACHINE:
|
||||||
return Type.SESSION_DISABLED;
|
confirmJobReturnCode = Error.Type.SESSION_DISABLED;
|
||||||
|
break retryLoop;
|
||||||
|
|
||||||
case JOB_VALIDATION_ERROR_MISSING_PARAMETER:
|
case JOB_VALIDATION_ERROR_MISSING_PARAMETER:
|
||||||
// no point to retry the request
|
// no point to retry the request
|
||||||
return Error.Type.UNKNOWN;
|
confirmJobReturnCode = Error.Type.UNKNOWN;
|
||||||
|
break retryLoop;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// do nothing, try to do a request on the next loop
|
// do nothing, try to do a request on the next loop
|
||||||
@@ -812,7 +818,7 @@ public class Client {
|
|||||||
Thread.sleep(32000);
|
Thread.sleep(32000);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
return Error.Type.UNKNOWN;
|
confirmJobReturnCode = Error.Type.UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -820,14 +826,16 @@ public class Client {
|
|||||||
this.isValidatingJob = false;
|
this.isValidatingJob = false;
|
||||||
this.previousJob = ajob;
|
this.previousJob = ajob;
|
||||||
|
|
||||||
|
if (confirmJobReturnCode == Error.Type.OK) {
|
||||||
gui.AddFrameRendered();
|
gui.AddFrameRendered();
|
||||||
|
}
|
||||||
|
|
||||||
// we can remove the frame file
|
// we can remove the frame file
|
||||||
File frame = new File(ajob.getOutputImagePath());
|
File frame = new File(ajob.getOutputImagePath());
|
||||||
frame.delete();
|
frame.delete();
|
||||||
ajob.setOutputImagePath(null);
|
ajob.setOutputImagePath(null);
|
||||||
|
|
||||||
return Error.Type.OK;
|
return confirmJobReturnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean shouldWaitBeforeRender() {
|
protected boolean shouldWaitBeforeRender() {
|
||||||
|
|||||||
Reference in New Issue
Block a user