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 6c69096..b5dfce5 100644 --- a/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java +++ b/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java @@ -25,6 +25,8 @@ public abstract class DocumentElaboration { protected static final String ID = Record.ID; + protected static final int THRESHOLD_FOR_FIVE_PERCENT = 100000; + protected final AggregationStatus aggregationStatus; protected final File file; protected final Bucket bucket; @@ -52,7 +54,11 @@ public abstract class DocumentElaboration { logger.info("{} - Going to elaborate {} rows", aggregationStatus.getAggregationInfo(), rowToBeElaborated); - int tenPercentOfNumberOfRows = (rowToBeElaborated/10)+1; + int percentOfNumberOfRows = (rowToBeElaborated/10)+1; + if(rowToBeElaborated>=THRESHOLD_FOR_FIVE_PERCENT) { + percentOfNumberOfRows = percentOfNumberOfRows/2; + } + int elaborated = 0; String line; @@ -60,7 +66,7 @@ public abstract class DocumentElaboration { while ((line = br.readLine()) != null) { elaborateLine(line); ++elaborated; - if(elaborated % tenPercentOfNumberOfRows == 0){ + if(elaborated % percentOfNumberOfRows == 0){ int elaboratedPercentage = elaborated*100/rowToBeElaborated; logger.info("{} - Elaborated {} rows of {} (about {}%)", aggregationStatus.getAggregationInfo(), elaborated, rowToBeElaborated, elaboratedPercentage); }