Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

ethanndickson
Copy link
Member

@ethanndicksonethanndickson commentedAug 30, 2024
edited
Loading

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 fortime.Time and theinterval type in Postgres:

ethan=# SELECT    '2024-08-30'::DATE AS original_date,    ('2024-08-30'::DATE - INTERVAL '6 months') AS sub_date; original_date |      sub_date---------------+--------------------- 2024-08-30    | 2024-02-29 00:00:00(1 row)

Usingfunc (t Time) AddDate(years int, months int, days int) Time, wheremonths is-6:

Original: 2024-08-30 00:00:00 +0000 UTC6 Months Earlier: 2024-03-01 00:00:00 +0000 UTC

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.

@ethanndicksonGraphite App
Copy link
MemberAuthor

ethanndickson commentedAug 30, 2024
edited
Loading

This stack of pull requests is managed by Graphite.Learn more about stacking.

Join@ethanndickson and the rest of your teammates onGraphiteGraphite

@ethanndickson
Copy link
MemberAuthor

I realise now we could just skip the test with the in-memory DB... Happy to do either...

Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

@ethanndicksonethanndickson merged commit6287502 intomainAug 30, 2024
59 checks passed
@ethanndicksonethanndickson deleted the 08-30-fix_delete_workspace_agent_stats_after_180_days branchAugust 30, 2024 08:30
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 30, 2024
@mafredri
Copy link
Member

Nice find! I agree with the fix, predictability (180) is nicer than ambiguity (varying) 👍🏻

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@dannykoppingdannykoppingdannykopping approved these changes

@sreyasreyaAwaiting requested review from sreya

@mafredrimafredriAwaiting requested review from mafredri

Assignees

@ethanndicksonethanndickson

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

test flake:TestDeleteOldWorkspaceAgentStats
3 participants
@ethanndickson@mafredri@dannykopping

[8]ページ先頭

©2009-2025 Movatter.jp