Revision: 8081
Author:   xqt
Date:     2010-04-12 15:46:32 +0000 (Mon, 12 Apr 2010)

Log Message:
-----------
Limit the queue size for put_async() by config.max_queue_size

Modified Paths:
--------------
    trunk/pywikipedia/config.py
    trunk/pywikipedia/wikipedia.py

Modified: trunk/pywikipedia/config.py
===================================================================
--- trunk/pywikipedia/config.py 2010-04-12 15:36:23 UTC (rev 8080)
+++ trunk/pywikipedia/config.py 2010-04-12 15:46:32 UTC (rev 8081)
@@ -466,6 +466,12 @@
 # up to 30 minutes)
 retry_on_fail = True
 
+# How many pages should be put to a queue in asynchroneous mode.
+# If maxsize is <= 0, the queue size is infinite.
+# Increasing this value will increase memory space but could speed up
+# processing. As higher this value this effect will decrease.
+max_queue_size = 64
+
 # End of configuration section
 # ============================
 # System-level and User-level changes.

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py      2010-04-12 15:36:23 UTC (rev 8080)
+++ trunk/pywikipedia/wikipedia.py      2010-04-12 15:46:32 UTC (rev 8081)
@@ -7449,7 +7449,7 @@
         raise
         output(u'Sorry, no help available for %s' % moduleName)
 
-page_put_queue = Queue.Queue()
+page_put_queue = Queue.Queue(config.max_queue_size)
 def async_put():
     """Daemon; take pages from the queue and try to save them on the wiki."""
     while True:



_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn

Reply via email to