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

Publishing Message fails if Program exits directly after #741

Closed
JannikWilhelm opened this issue Aug 11, 2023 · 1 comment
Closed

Publishing Message fails if Program exits directly after #741

JannikWilhelm opened this issue Aug 11, 2023 · 1 comment
Labels
Status: Available No one has claimed responsibility for resolving this issue.

Comments

@JannikWilhelm
Copy link

Calling client.publish(topic, payload, qos=0) results in the message being handled as sent (client.on_publish function is executed)
But if the python script ends after the publish call, the message does not get sent.
Adding a time.sleep(1) after client.publish(...) consistently sends the message.

@github-actions github-actions bot added the Status: Available No one has claimed responsibility for resolving this issue. label Aug 11, 2023
@MattBrittan
Copy link
Contributor

If you want to publish a message and ensure it's left the client before exiting then use single. The library queues publish requests so 'Publish` is likely to return before the message is actually sent.

Closing this for now - if you still have an issue then feel free to reopen but please provide a full example.

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