Revision: 4131 Author: btongminh Date: 2007-08-29 17:20:31 +0000 (Wed, 29 Aug 2007)
Log Message: ----------- Only start the put queue if there is actually work to do.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2007-08-29 15:14:32 UTC (rev 4130) +++ trunk/pywikipedia/wikipedia.py 2007-08-29 17:20:31 UTC (rev 4131) @@ -1030,6 +1030,14 @@ """Asynchronous version of put (takes the same arguments), which places pages on a queue to be saved by a daemon thread. """ + try: + page_put_queue.mutex.acquire() + try: + _putthread.start() + except AssertionError: + pass + finally: + page_put_queue.mutex.release() page_put_queue.put((self, newtext, comment, watchArticle, minorEdit, force))
def put(self, newtext, comment=None, watchArticle = None, minorEdit = True, force=False): @@ -4678,7 +4686,8 @@ # identification for debugging purposes _putthread.setName('Put-Thread') _putthread.setDaemon(True) -_putthread.start() +## Don't start the queue if it is not necessary. +#_putthread.start()
def stopme(): """This should be run when a bot does not interact with the Wiki, or