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

ClearSnapshot should clean up watches #505

Open
jpeach opened this issue Oct 21, 2021 · 3 comments
Open

ClearSnapshot should clean up watches #505

jpeach opened this issue Oct 21, 2021 · 3 comments

Comments

@jpeach
Copy link
Contributor

jpeach commented Oct 21, 2021

func (cache *snapshotCache) ClearSnapshot(node string) {
cache.mu.Lock()
defer cache.mu.Unlock()
delete(cache.snapshots, node)
delete(cache.status, node)
}

ClearSnapshot deletes the status for a node, but the states can have watches in it that will now never get triggered. Perhaps the right approach is to close the watch channels. However, looking at the SOTW server, closing any of the watch channels will make the stream handler error out.

So it's not obvious to me what the behavior of watches should be when a snapshot is cleared, but it seems something should happen since a subsequent SetSnapshot would not trigger any watches.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 20, 2021
@jpeach
Copy link
Contributor Author

jpeach commented Nov 22, 2021

not stale

@levimm
Copy link

levimm commented Aug 18, 2022

I also met this issue. When I clear snapshot, I just want to clear the dynamic resources but keep those watches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants