-
Notifications
You must be signed in to change notification settings - Fork 4
[PB-2394] feat: calculate yesterday usage and first usage on first /usage call #668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…current /usage endpoint is hit
353ee64
to
ba42a8d
Compare
a020810
to
f8aa7a0
Compare
f8aa7a0
to
158535e
Compare
1dfd6b6
to
d9dea6a
Compare
1b05dc2
to
04a203a
Compare
…tUserUsedStorageIncrementally
sg-gs
requested changes
Aug 21, 2025
|
sg-gs
approved these changes
Aug 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements incremental usage calculation logic to track user storage usage over time. This PR adds the calculation and delta storage functionality without changing the current user-facing response, allowing us to monitor the new system's behavior before switching over.
How a request to
/usage
worksperiod
field (last_usage
)last_usage
exists, check iflast_usage.period === currentDate - 1 day
:last_usage.period
tocurrentDate - 1 day
, save this delta in usage table with yesterday's dateHow replacing a file works
Why are files created and updated on the same day ignored?
These files will be included in the next delta calculation (the following day). If we also save a delta for them on the current day, it would result in double-counting and incorrect calculations.