Skip to content

Commit

Permalink
GODRIVER-3292 [release/1.16] Pass context to custom mtest monitor (#1736
Browse files Browse the repository at this point in the history
)
  • Loading branch information
blink1073 authored Aug 7, 2024
1 parent 9d8f187 commit 6ac5ab9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mongo/integration/mtest/mongotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,25 +639,25 @@ func (t *T) createTestClient() {
// Setup command monitor
var customMonitor = clientOpts.Monitor
clientOpts.SetMonitor(&event.CommandMonitor{
Started: func(_ context.Context, cse *event.CommandStartedEvent) {
Started: func(ctx context.Context, cse *event.CommandStartedEvent) {
if customMonitor != nil && customMonitor.Started != nil {
customMonitor.Started(context.Background(), cse)
customMonitor.Started(ctx, cse)
}
t.monitorLock.Lock()
defer t.monitorLock.Unlock()
t.started = append(t.started, cse)
},
Succeeded: func(_ context.Context, cse *event.CommandSucceededEvent) {
Succeeded: func(ctx context.Context, cse *event.CommandSucceededEvent) {
if customMonitor != nil && customMonitor.Succeeded != nil {
customMonitor.Succeeded(context.Background(), cse)
customMonitor.Succeeded(ctx, cse)
}
t.monitorLock.Lock()
defer t.monitorLock.Unlock()
t.succeeded = append(t.succeeded, cse)
},
Failed: func(_ context.Context, cfe *event.CommandFailedEvent) {
Failed: func(ctx context.Context, cfe *event.CommandFailedEvent) {
if customMonitor != nil && customMonitor.Failed != nil {
customMonitor.Failed(context.Background(), cfe)
customMonitor.Failed(ctx, cfe)
}
t.monitorLock.Lock()
defer t.monitorLock.Unlock()
Expand Down

0 comments on commit 6ac5ab9

Please sign in to comment.