From 9506030842ed6d3db5448a258172fa877d4c27d4 Mon Sep 17 00:00:00 2001 From: acialini Date: Tue, 5 Dec 2023 10:09:35 +0100 Subject: [PATCH] [PRDP-268] feat: Updated RecoverNotNotifiedReceiptScheduled --- .../RecoverNotNotifiedReceiptScheduled.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/RecoverNotNotifiedReceiptScheduled.java b/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/RecoverNotNotifiedReceiptScheduled.java index 416fb33..1d1ae95 100644 --- a/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/RecoverNotNotifiedReceiptScheduled.java +++ b/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/RecoverNotNotifiedReceiptScheduled.java @@ -19,6 +19,8 @@ public class RecoverNotNotifiedReceiptScheduled { + private final boolean isEnabled = Boolean.parseBoolean(System.getenv().getOrDefault("NOT_NOTIFIED_AUTORECOVER_ENABLED", "true")); + private final Logger logger = LoggerFactory.getLogger(RecoverNotNotifiedReceiptMassive.class); private final ReceiptCosmosService receiptCosmosService; @@ -46,18 +48,22 @@ public void processRecoverNotNotifiedScheduledTrigger( OutputBinding> documentReceipts, final ExecutionContext context) { - logger.info("[{}] function called at {}", context.getFunctionName(), LocalDateTime.now()); + if (isEnabled) { - List receiptList = receiptMassiveRestore(ReceiptStatusType.IO_ERROR_TO_NOTIFY, receiptCosmosService); - logger.info(String.valueOf(receiptList.size())); - receiptList.addAll(receiptMassiveRestore(ReceiptStatusType.GENERATED, receiptCosmosService)); - logger.info(String.valueOf(receiptList.size())); + logger.info("[{}] function called at {}", context.getFunctionName(), LocalDateTime.now()); - if (receiptList.isEmpty()) { - logger.info("[{}] No Receipt to notify", context.getFunctionName()); - } + List receiptList = receiptMassiveRestore(ReceiptStatusType.IO_ERROR_TO_NOTIFY, receiptCosmosService); + logger.info(String.valueOf(receiptList.size())); + receiptList.addAll(receiptMassiveRestore(ReceiptStatusType.GENERATED, receiptCosmosService)); + logger.info(String.valueOf(receiptList.size())); + + if (receiptList.isEmpty()) { + logger.info("[{}] No Receipt to notify", context.getFunctionName()); + } - documentReceipts.setValue(receiptList); + documentReceipts.setValue(receiptList); + + } }