[Pywikipedia-l] SVN: [5671] trunk/pywikipedia
nicdumz at svn.wikimedia.org
nicdumz at svn.wikimedia.org
Sat Jul 5 10:48:13 UTC 2008
Revision: 5671
Author: nicdumz
Date: 2008-07-05 10:48:13 +0000 (Sat, 05 Jul 2008)
Log Message:
-----------
Fixing [ 2009068 ] diskcache files could be deleted when bot finishes :
__del__ is not guaranteed to be called everytime, in particular when reference cycles survive the garbage collection process.
Renaming __del__ to delete, and calling it from wikipedia::stopme
Modified Paths:
--------------
trunk/pywikipedia/diskcache.py
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/diskcache.py
===================================================================
--- trunk/pywikipedia/diskcache.py 2008-07-04 18:30:18 UTC (rev 5670)
+++ trunk/pywikipedia/diskcache.py 2008-07-05 10:48:13 UTC (rev 5671)
@@ -59,7 +59,7 @@
self.cache_file.seek(0)
self.cache = []
- def __del__(self):
+ def delete(self):
self.cache_file.close()
import os
os.unlink(self.cache_path)
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2008-07-04 18:30:18 UTC (rev 5670)
+++ trunk/pywikipedia/wikipedia.py 2008-07-05 10:48:13 UTC (rev 5671)
@@ -6332,6 +6332,10 @@
when it has stopped doing so. After a bot has run stopme() it will
not slow down other bots any more.
"""
+ if config.use_diskcache:
+ for site in _sites.itervalues():
+ if site._mediawiki_messages:
+ site._mediawiki_messages.delete()
get_throttle.drop()
def _flush():
More information about the Pywikipedia-l
mailing list