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:
parent
243c1cd6c7
commit
beddf36e7a
|
@ -79,8 +79,14 @@ public abstract class DocumentElaboration {
|
||||||
elaborateLine(line);
|
elaborateLine(line);
|
||||||
elaborate = false;
|
elaborate = false;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
logger.debug("Elaboration of line {} failed due to {}. Retrying in {} {}", line, e.getMessage(),
|
if(i != 1) {
|
||||||
delay, TimeUnit.MILLISECONDS.name().toLowerCase());
|
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) {
|
if(i < MAX_RETRY) {
|
||||||
TimeUnit.MILLISECONDS.sleep(delay);
|
TimeUnit.MILLISECONDS.sleep(delay);
|
||||||
delay = delay * 2;
|
delay = delay * 2;
|
||||||
|
|
Loading…
Reference in New Issue