I'm developing a telegram bot in Python using QuestDB as the database. I'm using psycopg3 library connecting to QuestDb over the postgres wire protocol in autocommit mode. The bot only executes SQL queries when it receives commands, but if the commands are more than 5 minutes apart I get the following error:
psycopg.OperationalError: consuming input failed: server closed the connection unexpectedly
In QuestDB documentation I see a config parameter which looks relevant to my problem:
pg.net.connection.timeout=300000
But I'm not sure if setting this parameter to 0 is the correct way to solve this issue. So, my question is: how to properly configure QuestDb server so it doesn't close idle connections?
pg.net.connection.timeout
is the correct setting to tweak in your case. 0
value is supported and treated as "no idle timeout" value.