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

Remove context from GridFS stream objects

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • 2.1.0
    • 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

            Assignee:
            Unassigned Unassigned
            Reporter:
            preston.vasquez@mongodb.com Preston Vasquez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: