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

Error/status handling in publish.single method #807

Closed
buhln opened this issue Jan 26, 2024 · 2 comments
Closed

Error/status handling in publish.single method #807

buhln opened this issue Jan 26, 2024 · 2 comments
Labels
Status: Available No one has claimed responsibility for resolving this issue.

Comments

@buhln
Copy link

buhln commented Jan 26, 2024

We are using the publish.single method for sending MQTT messages in a really low frequency and it works great as long the server is available. Unfortunatly we see no possibility at the moment to monitor the successfull sent of the message. Is there a possible solution for this?

If the server is not available we catch this by try/except...

Thanks in advance!
nico

@github-actions github-actions bot added the Status: Available No one has claimed responsibility for resolving this issue. label Jan 26, 2024
@PierreF
Copy link
Contributor

PierreF commented Jan 26, 2024

That seems like the wanted behavior. If publish.single return (without exception) your message is published. If not not, it's not published. Having a function raise exception on error (like network error) is the right behavior IMO.

I'm not sure what behavior you are expecting. Do you want publish.single to retry connection by itself (e.g. can't fail, either return on success or hang - possibly forever) ?

@buhln
Copy link
Author

buhln commented Jan 29, 2024

Hi, Thank you for your answer.

I was looking for the best way to handle this. As I mention, we are catch errors at the moment by try/except. If this is the best way to do this for this function I am fine with it. Thanks!

@buhln buhln closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Available No one has claimed responsibility for resolving this issue.
Projects
None yet
Development

No branches or pull requests

2 participants