Skip to content

Commit cf3f4a0

Browse files
GODRIVER-3292 Pass context to custom mtest monitor (#1721)
1 parent 57a8453 commit cf3f4a0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mongo/integration/mtest/mongotest.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -639,25 +639,25 @@ func (t *T) createTestClient() {
639639
// Setup command monitor
640640
var customMonitor = clientOpts.Monitor
641641
clientOpts.SetMonitor(&event.CommandMonitor{
642-
Started: func(_ context.Context, cse *event.CommandStartedEvent) {
642+
Started: func(ctx context.Context, cse *event.CommandStartedEvent) {
643643
if customMonitor != nil && customMonitor.Started != nil {
644-
customMonitor.Started(context.Background(), cse)
644+
customMonitor.Started(ctx, cse)
645645
}
646646
t.monitorLock.Lock()
647647
defer t.monitorLock.Unlock()
648648
t.started = append(t.started, cse)
649649
},
650-
Succeeded: func(_ context.Context, cse *event.CommandSucceededEvent) {
650+
Succeeded: func(ctx context.Context, cse *event.CommandSucceededEvent) {
651651
if customMonitor != nil && customMonitor.Succeeded != nil {
652-
customMonitor.Succeeded(context.Background(), cse)
652+
customMonitor.Succeeded(ctx, cse)
653653
}
654654
t.monitorLock.Lock()
655655
defer t.monitorLock.Unlock()
656656
t.succeeded = append(t.succeeded, cse)
657657
},
658-
Failed: func(_ context.Context, cfe *event.CommandFailedEvent) {
658+
Failed: func(ctx context.Context, cfe *event.CommandFailedEvent) {
659659
if customMonitor != nil && customMonitor.Failed != nil {
660-
customMonitor.Failed(context.Background(), cfe)
660+
customMonitor.Failed(ctx, cfe)
661661
}
662662
t.monitorLock.Lock()
663663
defer t.monitorLock.Unlock()

0 commit comments

Comments
 (0)