Skip to content
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

feat(mqtt): Use Token.WaitTimeout #165

Merged
merged 1 commit into from
Oct 3, 2023
Merged

feat(mqtt): Use Token.WaitTimeout #165

merged 1 commit into from
Oct 3, 2023

Conversation

subpop
Copy link
Collaborator

@subpop subpop commented Sep 26, 2023

When connecting to a broker and when publishing a message, use the
Token.WaitTimeout method instead of Token.Wait. Token.Wait waits
indefinitely, which can lead to situations when the client 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]

@subpop subpop marked this pull request as draft September 26, 2023 16:37
@subpop subpop requested a review from jirihnidek September 29, 2023 17:41
@subpop subpop marked this pull request as ready for review September 29, 2023 17:41
Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. I have only two small requests.

internal/transport/mqtt.go Outdated Show resolved Hide resolved
internal/transport/mqtt.go Show resolved Hide resolved
When connecting to a broker and when publishing a message, use the
`Token.WaitTimeout` method instead of `Token.Wait`. `Token.Wait` waits
indefinitely, which can lead to situations when the client 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]>
Signed-off-by: Link Dupont <[email protected]>
@subpop subpop force-pushed the token-wait-timeout branch from 5453891 to d69e55f Compare October 3, 2023 13:30
Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks for update! 👍

@jirihnidek jirihnidek merged commit 69fd538 into main Oct 3, 2023
@jirihnidek jirihnidek deleted the token-wait-timeout branch October 3, 2023 14:39
@subpop subpop mentioned this pull request Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants