-
Notifications
You must be signed in to change notification settings - Fork 23
refactor: use a single configurable timeout value #94
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
refactor: use a single configurable timeout value #94
Conversation
0dac5f7 to
eee1fa1
Compare
JPHutchins
left a comment
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.
Thank you! Specific to the upload / upgrade scenario, I think that we should expose a configurable "first timeout" with a reasonably long value. On some SMP servers, the first upload request may take a long time, especially on external flash. Generally, the short timeout is good because we want to detect an erroring SMP server, but we have to be able to handle a scenario where the request takes on the order of 40 seconds.
Smpmgr could expose this only where relevant, as an option on the upgrade and upload commands, rather than yet another global transport option.
eee1fa1 to
38db3cb
Compare
Replace magic default values to use a single per-client default timeout value. This allows higher layers (e.g. smpmgr) to specify a timeout value when necessary and otherwise rely on the default set when creating the client.
38db3cb to
52c04a2
Compare
|
Yes that makes sense. See the updated version (mostly a revert). How about taking the sum of both first_timeout_s and subsequent_timeout_s for the first request timeout? With the given scenario, it would make sense. For instance an openthread node which is a SED (sleepy end device) and might check for packets every 60s. I would want the subsequent_timeout_s to be 70s (set through the SMPClient _timeout property), and the timeout for the first request to be 70s + 40s = first_timeout_s + subsequent_timeout_s if the first ImageUploadWrite takes a long time to erase the flash. |
I read your changes more carefully and see that you did leave this exposed, so I think it's OK as is. I agree with your assessment about guessing at a reasonable value by adding them together, but it sounds hard to document and keep track of! So, in your example, user would need to call upload with |
JPHutchins
left a comment
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.
This is a really great improvement, thank you! I'm mostly suggesting adding the _s seconds unit for consistency. Functionally, this is a great upgrade!
We do have a discussion about improving the architecture. Presently, "transport" and "client" are sorta intertwined in ways that prevent some nice context management or more flexible usage in general - including the "global transport options" issue faced by smpmgr. Would love your feedback if you have time: #58
I bring this up because ownership of timeout raises questions about the transport/client relationship - is the timeout parameter of the transport (SED example you gave) or the protocol (the initial upload request taking longer, maybe)?
This is adressing intercreate/smpmgr#71. Replace magic default values to use a single per-client default timeout value. This allows higher layers (e.g. smpmgr) to specify a timeout value when necessary and otherwise rely on the default set when creating the client.
I removed a bunch of default values that were all over the place, please comment on the need to have these, I might be missing something!