Skip to content

Commit

Permalink
[PRDP-268] feat: Updated RecoverNotNotifiedReceiptScheduled
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyey committed Dec 5, 2023
1 parent cdedcd8 commit 9506030
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -46,18 +48,22 @@ public void processRecoverNotNotifiedScheduledTrigger(
OutputBinding<List<Receipt>> documentReceipts,
final ExecutionContext context) {

logger.info("[{}] function called at {}", context.getFunctionName(), LocalDateTime.now());
if (isEnabled) {

List<Receipt> 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<Receipt> 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);

}

}

Expand Down

0 comments on commit 9506030

Please sign in to comment.