Skip to content

Commit

Permalink
Don't attempt to close nil or previously-closed clients
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Utley <[email protected]>
  • Loading branch information
jutley committed Jan 26, 2023
1 parent 6caae63 commit 2ad8994
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion internal/controller/acl/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ func (c *connectDisconnector) Connect(ctx context.Context, mg resource.Managed)
}

func (c *connectDisconnector) Disconnect(ctx context.Context) error {
c.cachedClient.Close()
if c.cachedClient != nil {
c.cachedClient.Close()
}
c.cachedClient = nil
return nil
}

Expand Down
5 changes: 4 additions & 1 deletion internal/controller/topic/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ func (c *connectDisconnector) Connect(ctx context.Context, mg resource.Managed)
}

func (c *connectDisconnector) Disconnect(ctx context.Context) error {
c.cachedClient.Close()
if c.cachedClient != nil {
c.cachedClient.Close()
}
c.cachedClient = nil
return nil
}

Expand Down

0 comments on commit 2ad8994

Please sign in to comment.