Skip to content

Commit

Permalink
Fix HPFeeds not reconnecting (#417)
Browse files Browse the repository at this point in the history
* fixed hpfeeds not reconnecting

(cherry picked from commit 5794db6)

* HPFeeds:fixed reconnect parameter not being passed correctly

(cherry picked from commit 8f49576)
  • Loading branch information
Chrzi authored Mar 11, 2024
1 parent 94740df commit b60a928
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tanner/reporting/hpfeeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ def tryconnect(self):

if not self.connected:
raise Disconnect()
else:
logger.warning("Trying to connect, but already connected!")

def close_old(self):
if self.s:
Expand Down Expand Up @@ -227,9 +229,12 @@ def publish(self, chaninfo, data):
self.send(msgpublish(self.ident, c, data))
except Disconnect:
logger.info("Disconnected from broker (in publish).")
self.connected = False
if self.reconnect:
self.tryconnect()
else:
logger.info("Do not reconnect, aborting.")
self.close_old()
raise

def close(self):
Expand All @@ -241,6 +246,6 @@ def close(self):

def new(host=None, port=10000, ident=None, secret=None, reconnect=True):
try:
return HPC(host, port, ident, secret, reconnect)
return HPC(host, port, ident, secret, reconnect=reconnect)
except Exception:
raise

0 comments on commit b60a928

Please sign in to comment.