From 993983a70767b56d2ecde432fcea828068d8e7f9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 24 Sep 2010 10:05:54 -0600 Subject: [PATCH] Oops. Restore removed call to commit in set_path and have set_path call dirtied. Also limit the rate of metadata backups --- src/calibre/library/caches.py | 1 + src/calibre/library/database2.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 714579ec77..339f1393f5 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -48,6 +48,7 @@ class MetadataBackup(Thread): # {{{ time.sleep(2) if not self.dump_func([id_]): prints('Failed to backup metadata for id:', id_, 'again, giving up') + time.sleep(0.2) # Limit to five per second # }}} diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index a34ef9cf89..f62c4ce074 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -455,6 +455,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): self.add_format(id, format, stream, index_is_id=True, path=tpath, notify=False) self.conn.execute('UPDATE books SET path=? WHERE id=?', (path, id)) + self.dirtied([id], commit=False) + self.commit() self.data.set(id, self.FIELD_MAP['path'], path, row_is_id=True) # Delete not needed directories if current_path and os.path.exists(spath):