We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de2e331 commit eb2dee4Copy full SHA for eb2dee4
src/ChangeStream.php
@@ -117,7 +117,26 @@ public function next()
117
*/
118
public function rewind()
119
{
120
- $this->csIt->rewind();
+ $resumable = false;
121
+ try {
122
+ $this->csIt->rewind();
123
+ if ($this->valid()) {
124
+ $this->extractResumeToken($this->csIt->current());
125
+ }
126
+ } catch (RuntimeException $e) {
127
+ if (strpos($e->getMessage(), "not master") !== false) {
128
+ $resumable = true;
129
130
+ if ($e->getCode() === self::CURSOR_NOT_FOUND) {
131
132
133
+ if ($e instanceof ConnectionTimeoutException) {
134
135
136
137
+ if ($resumable) {
138
+ $this->resume();
139
140
}
141
142
/**
0 commit comments