Skip to content

Commit 57a1a68

Browse files
committed
do not set cost when closing network purchase
1 parent 00f94a9 commit 57a1a68

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/packages/server/compute/maintenance/purchases/manage-purchases.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,17 @@ async function endNetworkPurchases({ networkPurchases, server }) {
407407
start: purchase.period_start,
408408
end,
409409
});
410-
purchase.cost = Math.max(0.001, network.cost);
411410
purchase.period_end = end;
412411
purchase.description.amount = network.amount;
413-
purchase.description.cost = network.cost;
414412
purchase.description.last_updated = end.valueOf();
413+
// We very explicitly do NOT set any cost here. That will only be done 2 days
414+
// later via queries to BigQuery based on detailed billing export.
415+
// The purchase.description.amount may be used for display and to provide an estimate
416+
// and that's it.
415417
const pool = getPool();
416418
await pool.query(
417-
"UPDATE purchases SET cost=$1, period_end=$2, description=$3 WHERE id=$4",
418-
[purchase.cost, purchase.period_end, purchase.description, purchase.id],
419+
"UPDATE purchases SET cost=NULL, cost_so_far=NULL, period_end=$1, description=$2 WHERE id=$3",
420+
[purchase.period_end, purchase.description, purchase.id],
419421
);
420422
}
421423
}

0 commit comments

Comments
 (0)