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):