-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
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.