Oops. Restore removed call to commit in set_path and have set_path call dirtied. Also limit the rate of metadata backups

This commit is contained in:
Kovid Goyal 2010-09-24 10:05:54 -06:00
parent 0acfe17e53
commit 993983a707
2 changed files with 3 additions and 0 deletions

View File

@ -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
# }}}

View File

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