diff options
author | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-22 00:48:30 (GMT) |
---|---|---|
committer | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-22 00:48:30 (GMT) |
commit | f1f0bbdfb486639812b0e04389feb67b83540b73 (patch) | |
tree | 67c2c4ae3cdf226b0df2a49f55633c4b8d7eebdc /src/olpc/datastore/xapianindex.py | |
parent | fd4056b0893b44f6ce13ab0fc94fede440f549a1 (diff) |
improved importer used in USB cases
includes additional metadata -- ctime/mtime/title
walk of content is now async -- results become available as indexed
introduced a workaround to dbus.mainloop.run() blocking the other threads
this is only a work around and not the intended way to fix this issue
but it does allow the other threads to run which means you'll see indexing
in the background.
Diffstat (limited to 'src/olpc/datastore/xapianindex.py')
-rw-r--r-- | src/olpc/datastore/xapianindex.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/olpc/datastore/xapianindex.py b/src/olpc/datastore/xapianindex.py index a6f8994..3710d68 100644 --- a/src/olpc/datastore/xapianindex.py +++ b/src/olpc/datastore/xapianindex.py @@ -17,7 +17,8 @@ from Queue import Queue, Empty import logging import re import sys - +import time +import thread import threading import warnings @@ -91,10 +92,11 @@ class IndexManager(object): self.read_index = secore.SearchConnection(repo) self.flush() - # by default we start the indexer now self.startIndexer() + assert self.indexer.isAlive() + def bind_to(self, backingstore): # signal from backingstore that its our parent self.backingstore = backingstore @@ -147,7 +149,7 @@ class IndexManager(object): if not filestuff: # In this case we are done return - + self.queue.put((uid, vid, doc, operation, filestuff)) def indexThread(self): @@ -160,8 +162,10 @@ class IndexManager(object): # include timeout here to ease shutdown of the thread # if this is a non-issue we can simply allow it to block try: - uid, vid, doc, operation, filestuff = self.queue.get(timeout=0.5) + data = self.queue.get(True, 0.025) + uid, vid, doc, operation, filestuff = data except Empty: + #time.sleep(1.0) continue try: |