GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||
GeezerVison is showing github.com — v0.6.72: billing pool contention fix by TheodoreSpeaks · Pull Request #4496 · simstudioai/sim Conversation
Contributor
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
… contention (#4494) * fix(billing): drop transaction wrapper in recordUsage to relieve pool contention * fix(billing): always warn on userStats drift in recordUsage
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit ec5793f. Bugbot is set up for automated code reviews on this repo. Configure here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Greptile SummaryThis PR removes the
Confidence Score: 4/5Safe to merge — the fix correctly addresses pool contention and the data durability trade-offs are clearly documented and intentional. The change is well-reasoned and the comments document the trade-offs clearly. The one gap is that all userStats UPDATE failures — including transient ones — are permanently dropped rather than retried, which could widen counter drift more than necessary. apps/sim/lib/billing/core/usage-log.ts — specifically the catch block in recordUsage and any downstream callers that read currentPeriodCost / totalCost from userStats to enforce billing limits. Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant recordUsage
participant DB_usageLog as DB: usage_log
participant DB_userStats as DB: user_stats
Caller->>recordUsage: recordUsage(params)
alt "validEntries.length > 0"
recordUsage->>DB_usageLog: INSERT rows (propagates errors)
DB_usageLog-->>recordUsage: OK / throws
end
recordUsage->>DB_userStats: UPDATE userStats (lastActive, totalCost, currentPeriodCost)
alt UPDATE succeeds, row found
DB_userStats-->>recordUsage: "[{userId}]"
recordUsage-->>Caller: void
else UPDATE succeeds, row NOT found
DB_userStats-->>recordUsage: []
recordUsage->>recordUsage: logger.warn (counter dropped)
recordUsage-->>Caller: void
else UPDATE throws
DB_userStats-->>recordUsage: error
recordUsage->>recordUsage: logger.warn (counter dropped)
recordUsage-->>Caller: void
end
Reviews (1): Last reviewed commit: "fix(billing): drop transaction wrapper i..." | Re-trigger Greptile |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
ec5793fb
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.