[scraper] ignores duplicates when creating contents

This commit is contained in:
TheBeastLT
2021-01-12 12:15:05 +01:00
parent 9f45e78f6d
commit b333607209

View File

@@ -273,7 +273,7 @@ function getUnassignedSubtitles() {
function createContents(infoHash, contents) {
if (contents && contents.length) {
return Content.bulkCreate(contents.map(content => ({ infoHash, ...content })))
return Content.bulkCreate(contents.map(content => ({ infoHash, ...content })), { ignoreDuplicates: true })
.then(() => Torrent.update({ opened: true }, { where: { infoHash: infoHash }, silent: true }));
}
return Promise.resolve();