Keep track of the newly inserted token records in media.local.search, or we can experience UniqueConstraint violations upon session commit because of duplicate records

This commit is contained in:
Fabio Manganiello 2019-09-02 23:05:16 +02:00
parent 1dca11c0be
commit e9c7104242

View file

@ -99,6 +99,7 @@ class LocalMediaSearcher(MediaSearcher):
continue continue
record = MediaToken.build(token=token) record = MediaToken.build(token=token)
session.add(record) session.add(record)
records[token] = record
session.commit() session.commit()
return session.query(MediaToken).filter( return session.query(MediaToken).filter(