@@ -318,9 +318,6 @@ func (c *CostCenterManager) ResetUsage(ctx context.Context, cc CostCenter) (Cost
318
318
319
319
now := time .Now ().UTC ()
320
320
321
- // Resetting the usage always resets the billing cycle start time
322
- billingCycleStart := now
323
-
324
321
// Default to 1 month from now, if there's no nextBillingTime set on the record.
325
322
nextBillingTime := now .AddDate (0 , 1 , 0 )
326
323
if cc .NextBillingTime .IsSet () {
@@ -333,12 +330,12 @@ func (c *CostCenterManager) ResetUsage(ctx context.Context, cc CostCenter) (Cost
333
330
return CostCenter {}, fmt .Errorf ("failed to compute invocie usage record for AttributonID: %s: %w" , cc .ID , err )
334
331
}
335
332
336
- // All fields on the new cost center remain the same, except for CreationTime and NextBillingTime
333
+ // All fields on the new cost center remain the same, except for BillingCycleStart, NextBillingTime, and CreationTime
337
334
newCostCenter := CostCenter {
338
335
ID : cc .ID ,
339
336
SpendingLimit : spendingLimit ,
340
337
BillingStrategy : cc .BillingStrategy ,
341
- BillingCycleStart : NewVarcharTime (billingCycleStart ),
338
+ BillingCycleStart : NewVarcharTime (now ),
342
339
NextBillingTime : NewVarcharTime (nextBillingTime ),
343
340
CreationTime : NewVarcharTime (now ),
344
341
}
0 commit comments