[x] Added tests for code changes or test/build only changes
[x] Updated the change log file (CHANGES.md|CHANGELOG.md) or test/build only changes
[x] Completed the PR template below:
Description
Ensure callback gets called for errors after response is already being processed.
Fixes #456
Approach
Add a flag when the execution loop is stopped.
Force the client callback when processing a callback error if the flag is set.
Update documentation to clarify behaviour of retry plugin.
It is worth noting the current behaviour on an error encountered during response processing when using the retry plugin is:
The retry plugin asks for a retry, but it does not get executed.
Callback style -> hangs with the callback not called
Listener style -> an event is emitted for the error (between the response and end events)
This change retains the current behaviour except for the hang where the callback isn't called. It is not possible to allow retries once the response is already processing because it will change the events in the listener style usage (and multiple response or data events will be unexpected and difficult to manage).
Schema & API Changes
No change
Added documentation clarification for expected behaviour of retry plugin.
Security and Privacy
"No change"
Testing
Added new tests:
does not retry in response data phase for callback onlylistener only and callback and listener scenarios of retry plugin tests
The tests cannot use nock because it does not trigger the timeouts, so they use their own mock server.
Checklist
CHANGES.md
|CHANGELOG.md
) or test/build only changesDescription
Ensure callback gets called for errors after response is already being processed.
Fixes #456
Approach
error
if the flag is set.It is worth noting the current behaviour on an error encountered during response processing when using the retry plugin is:
response
andend
events)This change retains the current behaviour except for the hang where the callback isn't called. It is not possible to allow retries once the response is already processing because it will change the events in the listener style usage (and multiple response or data events will be unexpected and difficult to manage).
Schema & API Changes
Security and Privacy
Testing
does not retry in response data phase
forcallback only
listener only
andcallback and listener
scenarios of retry plugin testsThe tests cannot use
nock
because it does not trigger the timeouts, so they use their own mock server.Monitoring and Logging