|
In Go, a context.Context is goroutine safe, and users expect this to be true. A mongo.SessionContext is not goroutine safe, even though it's used as a context.Context when being passed to methods. This causes confusion for users. Additionally, it is not clear to users that the context created by the WithSession function or UseSession* methods should not escape the scope of the closure.
While it's likely to be usable by documenting that a mongo.SessionContext is not goroutine safe, it is likely that users will continue to attempt to use a mongo.SessionContext with goroutines, whether inside a closure or external to it.
|