From 4dbf49855a39060a4e52a396d2049806f435aa58 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 30 Jul 2013 11:55:58 +0530 Subject: [PATCH] ... --- src/calibre/db/cache.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index 505342173f..8d19c7e9f8 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -1142,6 +1142,9 @@ class Cache(object): if extra is not None or force_changes: protected_set_field(idx, extra) except: + # sqlite will rollback the entire transaction, thanks to the with + # statement, so we have to re-read everything form the db to ensure + # the db and Cache are in sync self._reload_from_db() raise