-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug in Fetch earliest offsets #572
Conversation
…etch-earliest-offsets
…etch-earliest-offsets
…tch-earliest-offsets
-call proper fetch method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I know the code is copied from before I never liked this timeout since there's no guarantee it will be ready within 100ms.
Could we add a once
listener to the ready
event instead? It seems like it would be more reliable.
@hyperlink requested changes made but your tests fail due to the changes |
Right, those tests should fail because they rely on the ready var being changed. Can you update the test to emit |
setTimeout(function () { | ||
this.fetch(payloads, cb); | ||
}.bind(this), 100); | ||
this.once('ready', () => this.fetch(payloads, cb).bind(this)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need a bind here since we're using fat arrow.
setTimeout(function () { | ||
this.commit(groupId, payloads, cb); | ||
}.bind(this), 100); | ||
this.once('ready', () => this.commit(groupId, payloads, cb).bind(this)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto here.
setTimeout(function () { | ||
this.fetchCommits(groupId, payloads, cb); | ||
}.bind(this), 100); | ||
this.once('ready', () => this.fetchCommits(groupId, payloads, cb).bind(this)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here.
@hyperlink, good to go? |
Published as 1.3.3. |
when offset isnt ready need to call proper method in setTimeout.