We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d0b23b commit fdb9474Copy full SHA for fdb9474
event/examples_test.go
@@ -32,12 +32,18 @@ func ExampleCommandMonitor() {
32
startedCommands[evt.RequestID],
33
evt.Reply,
34
)
35
+
36
+ // Empty "startedCommands" for the request ID to avoid a memory leak.
37
+ delete(startedCommands, evt.RequestID)
38
},
39
Failed: func(_ context.Context, evt *event.CommandFailedEvent) {
40
log.Printf("Command: %v Failure: %v\n",
41
42
evt.Failure,
43
44
45
46
47
48
}
49
clientOpts := options.Client().ApplyURI("mongodb://localhost:27017").SetMonitor(cmdMonitor)
0 commit comments