Skip to content
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

feat: make cleaner safe for concurrent use #552

Merged
merged 2 commits into from
Feb 10, 2023
Merged

feat: make cleaner safe for concurrent use #552

merged 2 commits into from
Feb 10, 2023

Conversation

pmalek
Copy link
Member

@pmalek pmalek commented Feb 10, 2023

No description provided.

@pmalek pmalek added the area/feature New feature or request label Feb 10, 2023
@pmalek pmalek self-assigned this Feb 10, 2023
@pmalek pmalek marked this pull request as ready for review February 10, 2023 12:29
@pmalek pmalek requested review from a team and shaneutt as code owners February 10, 2023 12:29
@pmalek pmalek temporarily deployed to gcloud February 10, 2023 12:29 — with GitHub Actions Inactive
@pmalek pmalek temporarily deployed to gcloud February 10, 2023 12:48 — with GitHub Actions Inactive
@pmalek pmalek disabled auto-merge February 10, 2023 13:32
randmonkey
randmonkey previously approved these changes Feb 10, 2023
@pmalek pmalek added this pull request to the merge queue Feb 10, 2023
auto-merge was automatically disabled February 10, 2023 14:34

Merge queue setting changed

@pmalek pmalek removed this pull request from the merge queue due to the queue being cleared Feb 10, 2023
@pmalek pmalek temporarily deployed to gcloud February 10, 2023 14:37 — with GitHub Actions Inactive
@pmalek pmalek enabled auto-merge (squash) February 10, 2023 14:37
@pmalek pmalek requested review from randmonkey and a team February 10, 2023 14:37
@pmalek pmalek temporarily deployed to gcloud February 10, 2023 14:55 — with GitHub Actions Inactive
@pmalek pmalek merged commit 3c522df into main Feb 10, 2023
@pmalek pmalek deleted the concurrent-cleaner branch February 10, 2023 15:05
Comment on lines +63 to +64
c.lock.RLock()
defer c.lock.RUnlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure in practice if this will end up mattering, but it seems a bit odd to make the actual cleanup a "ready only" lock, considering all the mutations it's making.

Actually, it occurs to me now that what we should probably do is lock the object and block all future changes once we've run cleanup. E.g. any Add to the cleaner fails after Cleanup is called.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've create an issue to track this: #563.

This should be OK for now (at least for our internal usage). We might take another approach at this when indeed we use cleaners more than once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants