@@ -101,12 +101,12 @@ public function next()
101
101
$ this ->hasAdvanced = true ;
102
102
$ this ->resumeToken = $ this ->extractResumeToken ($ this ->csIt ->current ());
103
103
}
104
- // If the cursorId is 0, the server has invalidated the cursor so we
105
- // will never perform another getMore. This means that we cannot
106
- // resume and we can therefore unset the resumeCallable, which will
107
- // free any reference to Watch. This will also free the only
108
- // reference to an implicit session, since any such reference
109
- // belongs to Watch.
104
+ /* If the cursorId is 0, the server has invalidated the cursor so we
105
+ * will never perform another getMore. This means that we cannot
106
+ * resume and we can therefore unset the resumeCallable, which will
107
+ * free any reference to Watch. This will also free the only
108
+ * reference to an implicit session, since any such reference
109
+ * belongs to Watch. */
110
110
if ($ this ->getCursorId () === 0 ) {
111
111
unset($ this ->resumeCallable );
112
112
}
@@ -139,12 +139,7 @@ public function rewind()
139
139
$ this ->hasAdvanced = true ;
140
140
$ this ->resumeToken = $ this ->extractResumeToken ($ this ->csIt ->current ());
141
141
}
142
- // If the cursorId is 0, the server has invalidated the cursor so we
143
- // will never perform another getMore. This means that we cannot
144
- // resume and we can therefore unset the resumeCallable, which will
145
- // free any reference to Watch. This will also free the only
146
- // reference to an implicit session, since any such reference
147
- // belongs to Watch.
142
+ // As with next(), free the callable once we know it will never be used.
148
143
if ($ this ->getCursorId () === 0 ) {
149
144
unset($ this ->resumeCallable );
150
145
}
0 commit comments