Skip to content

Commit a5f49b5

Browse files
committed
Fix bug in client pool cache population.
1 parent 4a16631 commit a5f49b5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/gonvif/pool.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ func (p *pool) newClientSynced(k key) (Client, error) {
6565
func (p *pool) newClient(k key) (Client, error) {
6666
client, err := New(k.baseURL, k.username, k.password, k.verbose)
6767
if err != nil {
68-
p.cache.Set(k, client, ttlcache.DefaultTTL)
68+
return nil, err
6969
}
70-
return client, err
70+
p.cache.Set(k, client, ttlcache.DefaultTTL)
71+
return client, nil
7172
}
7273

7374
var escaper = strings.NewReplacer(

0 commit comments

Comments
 (0)