Skip to content

Commit

Permalink
fix(confmws/confmqtt): fix NewClient, try fetch client by id from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
saitofun committed Jul 19, 2024
1 parent fbe6bce commit 7ebbcbc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions confmws/confmqtt/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ func (b *Broker) NewClient(id, topic string) (*Client, error) {
if topic == "" {
return nil, ErrInvalidTopic
}
if c, ok := b.clients.Load(id); ok && c != nil {
return c.(*Client), nil
}

option := b.options(id)

c := &Client{
Expand Down

0 comments on commit 7ebbcbc

Please sign in to comment.