##// END OF EJS Templates
Move with statement so history db cache is written out in one transaction (two if output history is being logged).
Thomas Kluyver -
Show More
@@ -411,14 +411,14 b' class HistoryManager(Configurable):'
411 411 self.writeout_cache()
412 412
413 413 def _writeout_input_cache(self):
414 for line in self.db_input_cache:
415 with self.db:
414 with self.db:
415 for line in self.db_input_cache:
416 416 self.db.execute("INSERT INTO history VALUES (?, ?, ?, ?)",
417 417 (self.session_number,)+line)
418 418
419 419 def _writeout_output_cache(self):
420 for line in self.db_output_cache:
421 with self.db:
420 with self.db:
421 for line in self.db_output_cache:
422 422 self.db.execute("INSERT INTO output_history VALUES (?, ?, ?)",
423 423 (self.session_number,)+line)
424 424
@@ -432,7 +432,7 b' class HistoryManager(Configurable):'
432 432 "database. History logging moved to new session",
433 433 self.session_number)
434 434 try: # Try writing to the new session. If this fails, don't recurse
435 self.writeout_cache()
435 self._writeout_input_cache()
436 436 except sqlite3.IntegrityError:
437 437 pass
438 438 finally:
General Comments 0
You need to be logged in to leave comments. Login now