Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-298

Do not rewind command cursor in ChangeStream constructor

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

      Once PHPC-1050 is resolved, we should ensure that the ChangeStream iterator does not rewind its internal command cursor upon construction. The initial rewind will likely advance the cursor and check for an error, which is prone to issuing a getMore command if the first batch is empty (as it typically will be for new change streams). That getMore incurs an unexpected delay (one second by default), which would happen during the call to Collection::watch().

      If we instead rely on users to invoke ChangeStream::rewind() when they begin iteration, we can defer that initial getMore to the beginning of iteration.

            Assignee:
            katherine.walker@mongodb.com Katherine Walker (Inactive)
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: