jenkins-bot has submitted this change and it was merged.
Change subject: RCStream: return heartbeats and handle on_reconnect ......................................................................
RCStream: return heartbeats and handle on_reconnect
Bug: T85717 Change-Id: I20b02488bd9302a3ed8846b344c870eb6763e651 --- M pywikibot/comms/rcstream.py 1 file changed, 10 insertions(+), 1 deletion(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/comms/rcstream.py b/pywikibot/comms/rcstream.py index 7b4ea73..b5d2230 100644 --- a/pywikibot/comms/rcstream.py +++ b/pywikibot/comms/rcstream.py @@ -104,7 +104,16 @@ self.emit('subscribe', thread.wikihost) debug('Subscribed to %s' % thread.wikihost, _logger)
+ def on_reconnect(self): + debug('Reconnected to %r' % (thread,), _logger) + self.on_connect() + + class GlobalListener(socketIO_client.BaseNamespace): + def on_heartbeat(self): + self._transport.send_heartbeat() + self.client.define(RCListener, rcpath) + self.client.define(GlobalListener)
def __repr__(self): """ Return representation. """ @@ -115,7 +124,7 @@ def run(self): """ Threaded function. Runs insided the thread when started with .start(). """ self.running = True - while self.running and self.client.connected: + while self.running: self.client.wait(seconds=0.1) debug('Shut down event loop for %r' % self, _logger) self.client.disconnect()