-
Notifications
You must be signed in to change notification settings - Fork 37
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
Use Token.WaitTimeout #192
Conversation
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.
Overall this looks good. Although I have one question. Why on mqtt.go not all the publish that use toke.Wait uses the timeout? (case Ping or cas reconnect)
Ah, this was an oversight on my part. I wrote this patch using the |
When connecting to a broker and publishing a message, use the `Token.WaitTimeout` method instead of `Token.Wait`. `Token.Wait` waits indefinitely, which can lead to situations when the cleint never succeeds in connecting or publishing. The timeout for each operation can be configured independently by setting `mqtt-connect-timeout` and `mqtt-publish-timeout`. Both values default to 30 seconds. The flags are hidden, as they should not commonly be required to be changed by users. Signed-off-by: Link Dupont <[email protected]>
Updated to include the missed uses of `Token.Wait(). |
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.
LGTM
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.
LGTM
This is a backport of #165 to yggdrasil-0.2.
When connecting to a broker and publishing a message, use the
Token.WaitTimeout
method instead ofToken.Wait
.Token.Wait
waitsindefinitely, which can lead to situations when the cleint never
succeeds in connecting or publishing.
The timeout for each operation can be configured independently by
setting
mqtt-connect-timeout
andmqtt-publish-timeout
. Both valuesdefault to 30 seconds. The flags are hidden, as they should not commonly
be required to be changed by users.
Fixes: CCT-123