Refs #11258 Added retry when inserting or deleting documents

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-aggregator-se-plugin@164527 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-02-22 14:37:04 +00:00
parent 243c1cd6c7
commit beddf36e7a
1 changed files with 8 additions and 2 deletions

View File

@ -79,8 +79,14 @@ public abstract class DocumentElaboration {
elaborateLine(line);
elaborate = false;
} catch(Exception e) {
logger.debug("Elaboration of line {} failed due to {}. Retrying in {} {}", line, e.getMessage(),
delay, TimeUnit.MILLISECONDS.name().toLowerCase());
if(i != 1) {
logger.debug("Elaboration of line {} failed due to {}. Retrying {}{} time in {} {}", line,
e.getMessage(), i, i == 2 ? "nd" : i == 3 ? "rd" : "th", delay,
TimeUnit.MILLISECONDS.name().toLowerCase());
} else {
logger.warn("Elaboration of line {} failed due to {}. Retrying in {} {}", line,
e.getMessage(), delay, TimeUnit.MILLISECONDS.name().toLowerCase());
}
if(i < MAX_RETRY) {
TimeUnit.MILLISECONDS.sleep(delay);
delay = delay * 2;