Skip to content

Commit

Permalink
docs: add docstring to docref watch
Browse files Browse the repository at this point in the history
  • Loading branch information
crwilcox committed Jan 27, 2021
1 parent 29be7f4 commit 7923cbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion firestore/docref.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,8 @@ type DocumentSnapshotIterator struct {
// the current state of the document. If the document has been deleted, Next
// returns a DocumentSnapshot whose Exists method returns false.
//
// Next never returns iterator.Done unless it is called after Stop.
// Next is not expected to return iterator.Done unless it is called after Stop.
// Rarely, networking issues may also cause iterator.Done to be returned.
func (it *DocumentSnapshotIterator) Next() (*DocumentSnapshot, error) {
btree, _, readTime, err := it.ws.nextSnapshot()
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions firestore/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func (s *watchStream) nextSnapshot() (*btree.BTree, []DocumentChange, time.Time,
for !s.handleNextMessage() {
}
if s.err != nil {
// NOTE: Seems this is probably the close that cusutomers are seeing?
_ = s.close() // ignore error
return nil, nil, time.Time{}, s.err
}
Expand Down Expand Up @@ -225,6 +226,7 @@ func (s *watchStream) handleNextMessage() bool {
s.resetDocs() // Remove all the current results.
// The filter didn't match; close the stream so it will be re-opened on the next
// call to nextSnapshot.
// NOTE: could also be this one.
_ = s.close() // ignore error
s.lc = nil
}
Expand Down

0 comments on commit 7923cbf

Please sign in to comment.