-
Notifications
You must be signed in to change notification settings - Fork 87
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_for_OrionCB Payload loss #1408
base: master
Are you sure you want to change the base?
Fix_for_OrionCB Payload loss #1408
Conversation
Gentle Reminder! |
lib/request-shim.js
Outdated
@@ -52,7 +52,7 @@ function getOptions(options) { | |||
searchParams: options.searchParams || options.qs, | |||
headers: options.headers, | |||
throwHttpErrors: options.throwHttpErrors || false, | |||
retry: options.retry || 0, | |||
retry: options.retry || 5, |
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.
Taken into account this retry
parameter, I wonder if the loop based in retry_count
is really needed. Could you include got library documentation about this retry
option, please?
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.
Hi @fgalan , I include this retry count to make the default value less than httpOptions.retry so that the agent can retry 5 times before error.
Same here in https://github.com/telefonicaid/iotagent-json/blob/ef782f8f89ea2d0769dc36ecf9d96c63ef82cc17/lib/bindings/AMQPBinding.js#L130
and numRetried is used.
And please reply if I have to code it in camel case
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.
According to https://github.com/sindresorhus/got#documentation
By default, Got will retry on failure. To disable this option, set options.retry.limit to 0.
Thus, I'd say that the only needed modification is to unhardwire the 0 value currently used, so it can be configured (by config.js and env var).
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 mean, modifications from L98 to L130 wouldn't be necessary, as far as I understand.
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.
Hi @fgalan , I have changed the default value but the agent was not retrying to connect to orion CB when it was down. Thats why I have to code to make it retry 5 times and also through an error as it was initially doing but after retrying 5 times after a particular interval of time. Thanks for the reply.
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.
Do you mean that got library is not working properly? As far as I understand, the got library should deal with this.
https://github.com/sindresorhus/got/blob/main/documentation/7-retry.md shows a pretty sophisticated configuration. I'd suggest to see how it works and use it.
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.
Hi @fgalan , I just want to say to make that work we need some value to make it work 5 times so that it comes out of loop after max retries as it is implemented also in
and line 145
Did you test yourself if it works? I do not think so... Anyway, a tests verifying this new behaviour, together with the documentation are required. |
As @fgalan mentioned, this PR as it is right now is not the best way to implement CB retries, as the got driver implements retry options. The best is to wire those options (right now is disabled) Some test cases should be implemented, reflecting a failling connection and working after some retries. This should be configured as per device group, since the CB is also configurable at device group. |
Fix for issue #1407