From beddf36e7a98fda5fa288aa9ce0fdd14762659bb Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 22 Feb 2018 14:37:04 +0000 Subject: [PATCH] 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 --- .../aggregator/persist/DocumentElaboration.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java b/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java index fab893d..03244c9 100644 --- a/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java +++ b/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java @@ -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;