Skip to content

Commit

Permalink
Reconnect if kippo fails to publish to hpfeeds
Browse files Browse the repository at this point in the history
  • Loading branch information
katkad committed Aug 20, 2013
1 parent 903e478 commit 3c71438
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion appsupport/kippo/hpfeeds.py
Expand Up @@ -152,7 +152,13 @@ def read(self):
self.close()

def publish(self, channel, **kwargs):
self.send(msgpublish(self.ident, channel, json.dumps(kwargs).encode('latin1')))
try:
self.send(msgpublish(self.ident, channel, json.dumps(kwargs).encode('latin1')))
except Exception, e:
log.err('connection to hpfriends lost: {0}'.format(e))
log.err('connecting')
self.connect()
self.send(msgpublish(self.ident, channel, json.dumps(kwargs).encode('latin1')))

def sendfile(self, filepath):
# does not read complete binary into memory, read and send chunks
Expand Down

0 comments on commit 3c71438

Please sign in to comment.