← Back to team overview

mosquitto-users team mailing list archive

Looping - collect backlog?

 

Python client question:

Assuming that all messages on my system are sent with QOS=0,

If I use loop_start() rather than calling loop(0) repeatedly from a while
loop, is there likely to be any difference in the number of messages that a
subscribed client receives?  It looks to me like loop_start blocks for a
second between retrieval of messages.

I can afford to lose a message or two here and there but I need to be able
to be comfortable that most messages will be delivered.

I've chosen to use QOS 0 since I wanted to minimize the load and message
volume on the broker and if I lose 1 or 2 messages out of a thousand I can
tolerate that.  But if I'm at risk of losing 200 out of a thousand that's a
worry...
i.e.

examples:
while True:
    client.loop(0)
    time.sleep(0.001)

vs:

client.loop_start()

Follow ups