-
Notifications
You must be signed in to change notification settings - Fork 932
fix: delete workspace agent stats after 180 days #14489
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
fix: delete workspace agent stats after 180 days #14489
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @ethanndickson and the rest of your teammates on |
All reactions
Sorry, something went wrong.
I realise now we could just skip the test with the in-memory DB... Happy to do either... |
All reactions
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
All reactions
Nice find! I agree with the fix, predictability (180) is nicer than ambiguity (varying) 👍🏻 |
All reactions
Sorry, something went wrong.
dannykopping
sreya
mafredri
Successfully merging this pull request may close these issues.
test flake:TestDeleteOldWorkspaceAgentStats
Fixes #13430.
The test for purging old workspace agent stats from the DB was consistently failing when ran with Postgres towards the end of the month, but not with the in-memory DB.
This was because month intervals are calculated differently for
time.Time
and theinterval
type in Postgres:Using
func (t Time) AddDate(years int, months int, days int) Time
, wheremonths
is-6
:Since 6 months was chosen arbitrarily, we should be able to change it to 180 days, to remove any ambiguity between the in-memory DB, and the Postgres DB. The alternative solution would involve implementing Postgres' month interval algorithm in Go.
The UI only shows stats as old as 168 days (24 weeks), so a frontend change isn't required for the extra days of stats we lose in some cases.