Aug-09-2023, 05:51 PM
I found the bug causing my issue. It wasn't with the code I shared. It was a fault in how I was cleaning up the connections when I was done with them.
When my code was finished with a connection, it would make a call to agent.disconnect(), which decremented the connection counter. Later, Python would delete the agent object and part of that process was also to call agent.disconnect(). This resulted in my counter going down by two instead of one when I was finished with the connection.
I now ensure that I have a connection before I do a disconnect.
When my code was finished with a connection, it would make a call to agent.disconnect(), which decremented the connection counter. Later, Python would delete the agent object and part of that process was also to call agent.disconnect(). This resulted in my counter going down by two instead of one when I was finished with the connection.
I now ensure that I have a connection before I do a disconnect.