Skip to content

Commit 1d3edd5

Browse files
committed
feat: Enhance checkout expiration logic with detailed logging and new seeding options
1 parent bfd1631 commit 1d3edd5

8 files changed

Lines changed: 713 additions & 14 deletions

File tree

cmd/api/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ func expireCheckouts(server *api.Server, logger logger.Logger) {
9999
return
100100
}
101101

102-
amountExpired, err := checkoutUseCase.ExpireOldCheckouts()
102+
result, err := checkoutUseCase.ExpireOldCheckouts()
103103
if err != nil {
104104
logger.Error("Failed to expire old checkouts: %v", err)
105105
} else {
106-
logger.Info("Expired %d old checkouts", amountExpired)
106+
logger.Info("Checkout cleanup completed: %d abandoned, %d deleted, %d expired (total: %d)",
107+
result.AbandonedCount, result.DeletedCount, result.ExpiredCount,
108+
result.AbandonedCount+result.DeletedCount+result.ExpiredCount)
107109
}
108110
}

cmd/expire-checkouts/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ func main() {
4040
checkoutUseCase := diContainer.UseCases().CheckoutUseCase()
4141

4242
// Expire old checkouts
43-
amountExpired, err := checkoutUseCase.ExpireOldCheckouts()
43+
result, err := checkoutUseCase.ExpireOldCheckouts()
4444
if err != nil {
4545
logger.Fatal("Failed to expire old checkouts: %v", err)
4646
}
4747

48-
logger.Info("Expired %d old checkouts", amountExpired)
48+
logger.Info("Checkout cleanup completed:")
49+
logger.Info("- Abandoned checkouts: %d", result.AbandonedCount)
50+
logger.Info("- Deleted checkouts: %d", result.DeletedCount)
51+
logger.Info("- Expired checkouts: %d", result.ExpiredCount)
52+
logger.Info("Total processed: %d", result.AbandonedCount+result.DeletedCount+result.ExpiredCount)
4953
}

0 commit comments

Comments
 (0)