Skip to content

Commit 40066f5

Browse files
committed
mqtt transport v2
Signed-off-by: Wei Liu <[email protected]>
1 parent 6395632 commit 40066f5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/cloudevents/generic/options/v2/mqtt/transport_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ func setupTestBroker(t *testing.T) (*mochimqtt.Server, func()) {
7676
time.Sleep(100 * time.Millisecond)
7777

7878
cleanup := func() {
79+
// Add a delay before broker shutdown to ensure all MQTT client operations
80+
// complete. This prevents a race condition where broker shutdown tries to
81+
// close listener clients while client deletion is still in progress, which
82+
// can cause a deadlock in the mochi-mqtt server's client management.
83+
time.Sleep(200 * time.Millisecond)
7984
if err := broker.Close(); err != nil {
8085
t.Logf("failed to close broker: %v", err)
8186
}

0 commit comments

Comments
 (0)