Commit 26b1246a authored by Julien Muchembled's avatar Julien Muchembled

importer: speed up startup when the import is already finished

parent 9d14ea1b
...@@ -444,7 +444,10 @@ class ImporterDatabaseManager(DatabaseManager): ...@@ -444,7 +444,10 @@ class ImporterDatabaseManager(DatabaseManager):
zodb = self.zodb[-1] zodb = self.zodb[-1]
self.zodb_loid = zodb.shift_oid + zodb.next_oid - 1 self.zodb_loid = zodb.shift_oid + zodb.next_oid - 1
self.zodb_tid = self.db.getLastTID(self.zodb_ltid) or 0 self.zodb_tid = self.db.getLastTID(self.zodb_ltid) or 0
if callable(self._import): if callable(self._import): # XXX: why ?
if self.zodb_tid == self.zodb_ltid:
self._finished()
else:
self._import = self._import() self._import = self._import()
def doOperation(self, app): def doOperation(self, app):
...@@ -505,6 +508,9 @@ class ImporterDatabaseManager(DatabaseManager): ...@@ -505,6 +508,9 @@ class ImporterDatabaseManager(DatabaseManager):
if process: if process:
process.join() process.join()
self.commit() self.commit()
self._finished()
def _finished(self):
logging.warning("All data are imported. You should change" logging.warning("All data are imported. You should change"
" your configuration to use the native backend and restart.") " your configuration to use the native backend and restart.")
self._import = None self._import = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment