Fix_for_OrionCB Payload loss#1408
Fix_for_OrionCB Payload loss#1408KeshavSoni2511 wants to merge 7 commits intotelefonicaid:masterfrom
Conversation
|
Gentle Reminder! |
lib/request-shim.js
Outdated
| headers: options.headers, | ||
| throwHttpErrors: options.throwHttpErrors || false, | ||
| retry: options.retry || 0, | ||
| retry: options.retry || 5, |
There was a problem hiding this comment.
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.
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.
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.
I mean, modifications from L98 to L130 wouldn't be necessary, as far as I understand.
There was a problem hiding this comment.
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.
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.
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