-
Type: Task
-
Resolution: Unresolved
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Go Drivers
Context
Currently the GridFS stream objects GridFSUploadStream and GridFSDownloadStream maintain the context used to construct them as a field. This is rather dangerous and can lead to context misuse.
Definition of done
Open a Go Routine where the context is defined to cancel:
ctx, cancel := context.WithDeadline() go func() { <-someCondition cancel() }()
Specifically, use the pattern defined when checking a server: https://github.com/mongodb/mongo-go-driver/blob/d55b4b93d81c1850e86fab66857eda8156d63aa0/x/mongo/driver/topology/server.go#L590
Pitfalls
NA