kareemwaheed
Posts: 27
Joined: Mon Feb 25, 2019 11:47 am

Python script hang after idle

Thu Jan 16, 2020 7:52 am

Hi,

I created a python script that has 2 threads with MQTT connections 1 for publishing the sensor reading (if changed) and 1 for subscribing for taking an action

but i notice that after i leave it running with no publish or receive the script stop publishing and receiving and i have to restart it to make it work again

is there a solution for this issue ?

i thought about publishing a dummy message every X of second to refresh the connection.

is this a good idea ?

User avatar
neilgl
Posts: 1252
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Python script hang after idle

Fri Jan 17, 2020 9:34 am

Can you post the code so we can look at it?

Return to “Advanced users”