-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Create noRetry option on Connection.apply #6180
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
Conversation
… if it tries to send again (through the callback, which enables the possibility of fiber throwing exceptions)
…ts a noRetry option
Failed to do the proper reconnection in the test, so the stream only simulated one direction of reconnection. This version simulates the stream in both directions of the reconnection.
… of reset, only if they've sent at least once, and this happens before messageSent flag is cleared. This results in it getting it's callback as soon as quiescence triggers, and the callback is called with an Error 409.
// _outstandingMethodFinished. | ||
currentMethodBlock.splice(i, 1); | ||
// make sure that the method is told that it failed. | ||
methodInvoker.receiveResult(Meteor.Error(409, 'Method is non-idempotent but attempted to call a second time', |
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.
I would change this to an error string - for example "invocation-failed"
. Error numbers in DDP are deprecated and I'd like to get rid of them if possible. Also, including the word "idempotent" in the message might be confusing for developers who don't know what that means.
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.
Yeah, I was actually going to change that just as soon as I got home after re-reading the style guide today. If 'invocation-failed' is used, the test should also be updated to expect that.
This is amazing! I especially like that I can tell that the code doesn't do anything different if the Going to merge this now, and fix the docs later. |
Closes #6108 Pull request #6180 Test is included, as is updated documentation. All tests in ddp-client package (including new test for #6108) pass. Implemented as simply a noRetry flag on apply which triggers it to fail with a Meteor.Error('invocation-failed') instead of retrying on reconnect. Test passes, methods which are marked as noRetry get an error in case of reset, only if they've sent at least once, and this happens before messageSent flag is cleared. This results in it getting it's callback as soon as quiescence triggers, and the callback is called with an Error 'invocation-failed'. [stubailo: changed error code, fixed docs, squashed commits]
Amazing contribution! Merged as one commit: c80c741 I made some changes, hopefully that is OK with you! |
Totally ok with the changes. I made note of one where the test no longer reflects the new contract. I could provide another pull request, but I suspect it'd be easier for you to just modify the one line... |
Yep, doing that now! |
Done: 165ea96 Thanks for noticing. |
Closes #6108 Pull request #6180 Test is included, as is updated documentation. All tests in ddp-client package (including new test for #6108) pass. Implemented as simply a noRetry flag on apply which triggers it to fail with a Meteor.Error('invocation-failed') instead of retrying on reconnect. Test passes, methods which are marked as noRetry get an error in case of reset, only if they've sent at least once, and this happens before messageSent flag is cleared. This results in it getting it's callback as soon as quiescence triggers, and the callback is called with an Error 'invocation-failed'. [stubailo: changed error code, fixed docs, squashed commits]
Implements #6108.
Test is included, as is updated documentation.
All tests in ddp-client package (including new test for #6108) pass.
Implemented as simply a
noRetry
flag on apply which triggers it to fail with a Meteor.Error(409) instead of retrying on reconnect.