Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1849

ErrWaitQueueTimeout should wrap context error

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.6
    • Affects Version/s: None
    • Component/s: None
    • None

      When a request to acquire a semaphore in a connection pool returns an error, we return ErrWaitQueueTimeout here. However, this would only happen if the context has timed out or been cancelled, so the final user-facing error should wrap ctx.Err(). This would allow the user to do errors.Is(err, context.DeadlineExceeded) and also allow our mongo.IsTimeout() function to detect this case.

      We can't do this while also keeping the sentinel ErrWaitQueueTimeout value, but this is private API and users are likely not checking for it directly, so I propose we remove that error and instead introduce a new error type that wraps ctx.Err(), has an Unwrap method, and keeps the same message as ErrWaitQueueTimeout in case users are checking for substrings.

            Assignee:
            benji.rewis@mongodb.com Benji Rewis (Inactive)
            Reporter:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: