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

fix: don't panic if envContext is closed twice #417

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/relayenv/env_context_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ type envContextImpl struct {
doneMonitoringCredentials chan struct{}
connectionMapper ConnectionMapper
offline bool
closed bool
}

// Implementation of the DataStoreQueries interface that the streams package uses as an abstraction of
Expand Down Expand Up @@ -701,6 +702,11 @@ func (c *envContextImpl) FlushMetricsEvents() {

func (c *envContextImpl) Close() error {
c.mu.Lock()
if c.closed {
c.mu.Unlock()
return nil
}
c.closed = true
for _, client := range c.clients {
_ = client.Close()
}
Expand Down
Loading