Skip to content

Commit

Permalink
reduce invoice young time
Browse files Browse the repository at this point in the history
  • Loading branch information
coddmeistr committed Dec 25, 2024
1 parent 3dbd0fe commit d252e12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/billing/cron_whmcs_invoices_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ 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))
continue
}
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
}
Expand Down

0 comments on commit d252e12

Please sign in to comment.