From d252e1285e59028c853ba3bbd0c75c6b2ca575c8 Mon Sep 17 00:00:00 2001 From: coddmeistr Date: Wed, 25 Dec 2024 18:28:56 +0300 Subject: [PATCH] reduce invoice young time --- pkg/billing/cron_whmcs_invoices_syncer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/billing/cron_whmcs_invoices_syncer.go b/pkg/billing/cron_whmcs_invoices_syncer.go index d804e820a..468832d5a 100644 --- a/pkg/billing/cron_whmcs_invoices_syncer.go +++ b/pkg/billing/cron_whmcs_invoices_syncer.go @@ -81,7 +81,7 @@ func (s *BillingServiceServer) WhmcsInvoicesSyncerCronJob(ctx context.Context, l if _, ok := whmcsIdToInvoice[int(whmcsInvoice.Id)]; ok { continue } - // Do not create invoice if it is younger than 1 day (preventing accidental duplicate) + // Do not create invoice if it is younger than half a day (preventing accidental duplicate) dateCreated, err := time.Parse(time.DateTime, whmcsInvoice.CreatedAt) if err != nil { logI.Error("Failed to parse invoice created time", zap.Error(err)) @@ -89,7 +89,7 @@ func (s *BillingServiceServer) WhmcsInvoicesSyncerCronJob(ctx context.Context, l } created := dateCreated.Unix() const secondsInDay = 86400 - if created > 0 && (now-created < secondsInDay) { + if created > 0 && (now-created < secondsInDay/2) { logI.Info("Invoice is not presented in Nocloud, but it is too young. Skip") continue }