diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-12-11 19:36:08 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-12-11 19:39:52 (GMT) |
commit | 05f0b1c82be71c342551e2bdc2f7f927f6215beb (patch) | |
tree | 6fb1dd168f444d16933d3bc5cca590cc6a422fbd | |
parent | b6d2baa74eb3f0aacb1b1073a522073a15c14dd7 (diff) |
#2545: Just log a warning when unmounting a device that has already been removed.
-rw-r--r-- | src/olpc/datastore/backingstore.py | 14 | ||||
-rw-r--r-- | src/olpc/datastore/xapianindex.py | 7 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/olpc/datastore/backingstore.py b/src/olpc/datastore/backingstore.py index 12dc582..c8e90aa 100644 --- a/src/olpc/datastore/backingstore.py +++ b/src/olpc/datastore/backingstore.py @@ -22,6 +22,8 @@ import threading import errno import shutil import urllib +import traceback +import sys import dbus import xapian @@ -267,11 +269,13 @@ class FileBackingStore(BackingStore): if 'uri' not in desc: desc['uri'] = self.uri if 'title' not in desc: desc['title'] = self.uri - - fp = open(fn, 'w') - pickle.dump(desc, fp) - fp.close() - + try: + fp = open(fn, 'w') + pickle.dump(desc, fp) + fp.close() + except Exception: + logging.error('Unable to write descriptor:\n' + \ + ''.join(traceback.format_exception(*sys.exc_info()))) @staticmethod def parse(uri): diff --git a/src/olpc/datastore/xapianindex.py b/src/olpc/datastore/xapianindex.py index d071eba..a859aa9 100644 --- a/src/olpc/datastore/xapianindex.py +++ b/src/olpc/datastore/xapianindex.py @@ -22,6 +22,7 @@ import time import thread import threading import warnings +import traceback import secore import xapian as _xapian # we need to modify the QueryParser @@ -165,7 +166,11 @@ class IndexManager(object): self.deltact += 1 if force or self.deltact > FLUSH_THRESHOLD: with self._write_lock: - self.write_index.flush() + try: + self.write_index.flush() + except Exception: + logging.error('Index flush failed:\n' + \ + ''.join(traceback.format_exception(*sys.exc_info()))) #self.read_index.reopen() self.deltact = 0 else: |