Merlijn van Deen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/190719

Change subject: RCStream: Ignore changes after total is reached
......................................................................

RCStream: Ignore changes after total is reached

There could be 'on_change' messages queued that are still processed
before the thread fully shuts down. This prevents those messages from
appearing in the queue.

As far as I know, the message pump is single threaded, so the previous
on_change call is guaranteed to finish before the next one is called.

Bug: T85716
Change-Id: Ibe6aba6a42028568dbd956da14168fec1bbd920e
---
M pywikibot/comms/rcstream.py
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/19/190719/1

diff --git a/pywikibot/comms/rcstream.py b/pywikibot/comms/rcstream.py
index 688e0f6..fb310f9 100644
--- a/pywikibot/comms/rcstream.py
+++ b/pywikibot/comms/rcstream.py
@@ -83,6 +83,9 @@
         class RCListener(socketIO_client.BaseNamespace):
             def on_change(self, change):
                 debug('Received change %r' % change, _logger)
+                if not thread.running:
+                    debug('Thread in shutdown mode; ignoring change.', _logger)
+                    return
 
                 thread.count += 1
                 thread.queue.put(change)

-- 
To view, visit https://gerrit.wikimedia.org/r/190719
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe6aba6a42028568dbd956da14168fec1bbd920e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to