Skip to content

feat: purge old provisioner daemons #10949

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
merged 12 commits into from
Dec 1, 2023
Merged

feat: purge old provisioner daemons #10949

merged 12 commits into from
Dec 1, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Nov 30, 2023

Related: #10676

This PR extends dbpurge to delete provisioner daemons under the following conditions:

  • provisioner daemon got registered at least 7 days ago
  • provisioner daemon reported its status (updated_at) 7 days ago or before

The feature should clean old provisioner daemon entries, see https://dev.coder.com/api/v2/organizations/703f72a1-76f6-4f89-9de6-8a3989693fe5/provisionerdaemons .

Other changes:

  • use doTick pattern
  • run the first iteration immediately

@mtojek mtojek requested a review from johnstcn November 30, 2023 13:23
@mtojek mtojek self-assigned this Nov 30, 2023
@mtojek mtojek marked this pull request as ready for review November 30, 2023 14:04
@mtojek
Copy link
Member Author

mtojek commented Nov 30, 2023

In the follow-up I try to cover dbpurge with dbmock tests.

@mtojek mtojek requested a review from johnstcn November 30, 2023 14:49
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

If we're making changes to the core dbpurge logic then we should add tests first before merging. I'm working on adding these now.

@mtojek mtojek marked this pull request as draft December 1, 2023 11:52
@mtojek mtojek marked this pull request as ready for review December 1, 2023 12:42
@mtojek mtojek enabled auto-merge (squash) December 1, 2023 12:43
@mtojek mtojek merged commit 13b89f7 into main Dec 1, 2023
@mtojek mtojek deleted the 10676-prune-inactive branch December 1, 2023 12:43
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants