diff options
author | Benjamin Saller <bcsaller@objectrealms.net> | 2007-08-01 01:23:43 (GMT) |
---|---|---|
committer | Benjamin Saller <bcsaller@objectrealms.net> | 2007-08-01 01:23:43 (GMT) |
commit | 5e2cd8f6f49601514de7b50c7e32ad8a0228b176 (patch) | |
tree | 6d84c8e2280b22f4a955533a680531bfed8bcb1b /src | |
parent | 4e5de6d9675e83afc6ba442a19a832f0f0e2abab (diff) |
workaround for lack of close() on xapian database. Its tied to the C++ dtor. This forces Python gc() to collect on the objects which in turn releases the C++ objects and forces db shutdown. It looks to be the best I can do now.
Diffstat (limited to 'src')
-rw-r--r-- | src/olpc/datastore/xapianindex.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/olpc/datastore/xapianindex.py b/src/olpc/datastore/xapianindex.py index 671035d..d653f0e 100644 --- a/src/olpc/datastore/xapianindex.py +++ b/src/olpc/datastore/xapianindex.py @@ -14,6 +14,7 @@ __license__ = 'The GNU Public License V2+' from Queue import Queue, Empty +import gc import logging import re import sys @@ -106,7 +107,15 @@ class IndexManager(object): self.stopIndexer(force) self.write_index.close() self.read_index.close() - + # XXX: work around for xapian not having close() this will + # change in the future in the meantime we delete the + # references to the indexers and then force the gc() to run + # which should inturn trigger the C++ destructor which forces + # the database shut. + self.write_index = None + self.read_index = None + gc.collect() + # Index thread management def startIndexer(self): self.indexer_running = True |