Skip to content

Feat/stats#56

Merged
Spampa merged 2 commits into
mainfrom
feat/stats
Apr 19, 2026
Merged

Feat/stats#56
Spampa merged 2 commits into
mainfrom
feat/stats

Conversation

@Spampa
Copy link
Copy Markdown
Contributor

@Spampa Spampa commented Apr 19, 2026

This pull request focuses on improving data consistency and accuracy in API key usage tracking and report generation. The main changes include making database updates for API key usage more robust by using transactions with row-level locking, and adjusting how real-time report data is aggregated and returned.

API Key Usage Consistency:

  • Database updates for lastUsedAt in validateApiKey middleware are now wrapped in a transaction with a SELECT ... FOR UPDATE to ensure row-level locking and prevent race conditions during concurrent updates. [1] [2]

Report Generation and Real-Time Data Handling:

  • Real-time report data (realtimeBucket) is now appended only after aggregation, ensuring that only raw reports are aggregated and real-time data is not double-counted. [1] [2] [3]
  • When generating a report for a specific cash register, a new report is generated before fetching reports, and the timestamp of the returned report is explicitly set to the current time.

@Spampa Spampa merged commit 6ed30cc into main Apr 19, 2026
1 check passed
@Spampa Spampa deleted the feat/stats branch May 7, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant