Skip to content

Commit 92b8b5b

Browse files
GODRIVER-3444 Update error messages
1 parent 06692da commit 92b8b5b

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

internal/integration/unified/cursor_operation_execution.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ func executeIterateOnce(ctx context.Context, operation *operation) (*operationRe
3030

3131
return newDocumentResult(res, nil), nil
3232
}
33-
3433
return newErrorResult(cursor.Err()), nil
3534
}
3635

x/mongo/driver/operation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ func (op Operation) Execute(ctx context.Context) error {
698698
}
699699

700700
// Calculate maxTimeMS value to potentially be appended to the wire message.
701-
maxTimeMS, err := op.calculateMaxTimeMS(ctx, srvr.RTTMonitor().Min())
701+
maxTimeMS, err := op.calculateMaxTimeMS(ctx, srvr.RTTMonitor().Min(), srvr.RTTMonitor().Stats())
702702
if err != nil {
703703
return err
704704
}
@@ -1719,7 +1719,7 @@ func (op Operation) addClusterTime(dst []byte, desc description.SelectedServer)
17191719
// if the ctx is a Timeout context. If the context is not a Timeout context, it uses the
17201720
// operation's MaxTimeMS if set. If no MaxTimeMS is set on the operation, and context is
17211721
// not a Timeout context, calculateMaxTimeMS returns 0.
1722-
func (op Operation) calculateMaxTimeMS(ctx context.Context, rttMin time.Duration) (int64, error) {
1722+
func (op Operation) calculateMaxTimeMS(ctx context.Context, rttMin time.Duration, rttStats string) (int64, error) {
17231723
if op.OmitMaxTimeMS {
17241724
return 0, nil
17251725
}
@@ -1730,7 +1730,7 @@ func (op Operation) calculateMaxTimeMS(ctx context.Context, rttMin time.Duration
17301730
return 0, fmt.Errorf(
17311731
"calculated server-side timeout (%v ms) is less than or equal to 0 (%v): %w",
17321732
maxTimeMS,
1733-
rttMin,
1733+
rttStats,
17341734
ErrDeadlineWouldBeExceeded)
17351735
}
17361736

x/mongo/driver/operation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func TestOperation(t *testing.T) {
312312
t.Run(tc.name, func(t *testing.T) {
313313
t.Parallel()
314314

315-
got, err := tc.op.calculateMaxTimeMS(tc.ctx, tc.rttMin)
315+
got, err := tc.op.calculateMaxTimeMS(tc.ctx, tc.rttMin, tc.rttStats)
316316

317317
// Assert that the calculated maxTimeMS is less than or equal to the expected value. A few
318318
// milliseconds will have elapsed toward the context deadline, and (remainingTimeout

0 commit comments

Comments
 (0)