Xqt created this task.
Xqt added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  **List of steps to reproduce**:
  Run a script with changes pages asynchronously. In this case the command line 
was `pwb -simulate:10 newitem -start:a -lang:da -touch`. To ensure there is 
anything left to do the `newitem.py` script was modified in this way:
  
    def _callback(self, page, exc) -> None:
        if True or exc is None and self.opt.touch:
            ....
    
    def treat_page_and_item(self, page, item) -> None
        if False and item and item.exists():
            ....
  
  Run this script for a while, e.g. one minute and enforce a KeyboardInterrupt 
by pressing `Strg-C`. A blue message occurs:
  `Waiting for 5 pages to be put. Estimated time remaining: 0:00:25`
  
  Again press `Strg-C`. Now this message and question will be printed:
  
    There are 5 pages remaining in the queue. Estimated time remaining: 0:00:25
    Really exit? ([y]es, [N]o):
  
  Now type `n` for no.
  
  **What happens?**:
  
  The script terminates immediately:
  
    11 skip operations
    6 read operations
    6 write operations
    Execution time: 24 seconds
    Read operation time: 2.8 seconds
    Skip operation time: 2.2 seconds
    Write operation time: 4.0 seconds
    Script terminated successfully.
  
  Digging deeper in the code _putthread.is_alive() beomes False imediately 
after Keyboardinterrupt:
  
    if _putthread is not threading.current_thread():
        while (_putthread.is_alive()
               and (page_put_queue.qsize() > 0
                    or page_put_queue_busy.qsize() > 0)):
            try:
                _putthread.join(1)
            except KeyboardInterrupt:
                print('???', _putthread.is_alive())   # This gives False which 
is not an expected behaviour
                if input_yn('There are {} pages remaining in the queue. '
                            'Estimated time remaining: {}\nReally exit?'
                            .format(*remaining()),
                            default=False, automatic_quit=False):
  
  **What should have happened instead?**:
  
  `_putthread.is_alive()` should be `True` and the async calls should be 
processed further  until the queue in done .
  
  **Software version**:
  Python 10, Pywikibot 7.4

TASK DETAIL
  https://phabricator.wikimedia.org/T311076

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Xqt
Cc: Aklapper, pywikibot-bugs-list, Xqt, Jyoo1011, JohnsonLee01, SHEKH, 
Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont, JJMC89, 
Dvorapa, Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to