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

100% CPU if MQTT server is temporarily down #53

Open
rgaufman opened this issue Jun 1, 2021 · 3 comments
Open

100% CPU if MQTT server is temporarily down #53

rgaufman opened this issue Jun 1, 2021 · 3 comments

Comments

@rgaufman
Copy link

rgaufman commented Jun 1, 2021

When the MQTT server is down, Paho takes 100% CPU. Any way to change logic so it does not do this?

@rgaufman
Copy link
Author

Any ideas how to prevent 100% CPU when MQTT server is down?

@dankozlowski
Copy link

Is your program looping while trying to send a message when the broker is not available? Could you post some example code?

@rgaufman
Copy link
Author

rgaufman commented May 24, 2023

No looping, just opening a connection:

        @client = PahoMqtt::Client.new(
          clean_session: @clean_session, client_id: @client_id,
          username: @username, password: @password,
          # persistent
          persistent: true, reconnect_limit: 1000, reconnect_delay: 5,
          # Keep Alives
          keep_alive: 29, ack_timeout: 120,
          # Will
          will_topic: @will_topic, will_payload: 'offline',
          will_qos: 2, will_retain: true
        )
        @client.on_connack do
          logger.info 'MQTT Connected Successfully...'
        end
        @client.connect(@ip, @port)

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

No branches or pull requests

2 participants