Skip to content

Commit 745b04f

Browse files
committed
bugfix: queue/Example_connectionPool data race
Part of #218
1 parent 63f7f9a commit 745b04f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

queue/example_connection_pool_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,12 @@ func Example_connectionPool() {
185185

186186
// Wait for a new master instance re-identification.
187187
<-h.masterUpdated
188-
if h.err != nil {
189-
fmt.Printf("Unable to re-identify in the pool: %s", h.err)
188+
h.mutex.Lock()
189+
err = h.err
190+
h.mutex.Unlock()
191+
192+
if err != nil {
193+
fmt.Printf("Unable to re-identify in the pool: %s", err)
190194
return
191195
}
192196

0 commit comments

Comments
 (0)