Skip to content

ClearSnapshot should clean up watches #505

Description

@jpeach

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions