Use synchronize_session=fetch when synchronizing records on deletion
This commit is contained in:
parent
11af83f88f
commit
8a6be8b540
1 changed files with 3 additions and 2 deletions
|
@ -129,7 +129,8 @@ class LocalMediaSearcher(MediaSearcher):
|
||||||
self.logger.info('Directory {} is no longer accessible, removing it'.
|
self.logger.info('Directory {} is no longer accessible, removing it'.
|
||||||
format(media_dir))
|
format(media_dir))
|
||||||
session.query(MediaDirectory) \
|
session.query(MediaDirectory) \
|
||||||
.filter(MediaDirectory.path==media_dir).delete()
|
.filter(MediaDirectory.path==media_dir) \
|
||||||
|
.delete(synchronize_session='fetch')
|
||||||
return
|
return
|
||||||
|
|
||||||
stored_file_records = {
|
stored_file_records = {
|
||||||
|
@ -177,7 +178,7 @@ class LocalMediaSearcher(MediaSearcher):
|
||||||
|
|
||||||
session.query(MediaFile).filter(MediaFile.id.in_(
|
session.query(MediaFile).filter(MediaFile.id.in_(
|
||||||
[ record.id for record in stored_file_records.values() ]
|
[ record.id for record in stored_file_records.values() ]
|
||||||
)).delete()
|
)).delete(synchronize_session='fetch')
|
||||||
|
|
||||||
dir_record.last_indexed_at = datetime.datetime.now()
|
dir_record.last_indexed_at = datetime.datetime.now()
|
||||||
self.logger.info('Scanned {} in {} seconds'.format(
|
self.logger.info('Scanned {} in {} seconds'.format(
|
||||||
|
|
Loading…
Reference in a new issue