Skip to content

Commit c18963b

Browse files
committed
move to defer
1 parent ff2784c commit c18963b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

coderd/database/dbtestutil/driver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ func (d *Driver) AddConnection(conn driver.Conn) {
7979

8080
func (d *Driver) WaitForConnection() {
8181
ch := make(chan struct{})
82+
defer close(ch)
83+
defer delete(d.listeners, ch)
8284
d.listeners[ch] = ch
8385
<-ch
84-
delete(d.listeners, ch)
8586
}
8687

8788
func (d *Driver) DropConnections() {

0 commit comments

Comments
 (0)