From e9c710424260d3097f28866b2291c2ebce2a8782 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 2 Sep 2019 23:05:16 +0200 Subject: [PATCH] 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 --- platypush/plugins/media/search/local.py | 1 + 1 file changed, 1 insertion(+) diff --git a/platypush/plugins/media/search/local.py b/platypush/plugins/media/search/local.py index 204f39daa..046ad9f23 100644 --- a/platypush/plugins/media/search/local.py +++ b/platypush/plugins/media/search/local.py @@ -99,6 +99,7 @@ class LocalMediaSearcher(MediaSearcher): continue record = MediaToken.build(token=token) session.add(record) + records[token] = record session.commit() return session.query(MediaToken).filter(