diff --git a/scripts/commands/database/update.js b/scripts/commands/database/update.js index 20925fad8..540a6fdcb 100644 --- a/scripts/commands/database/update.js +++ b/scripts/commands/database/update.js @@ -19,9 +19,7 @@ main() async function updateStreams(items = [], results = {}, origins = {}) { logger.info('updating streams...') - let buffer = {} let updated = 0 - let removed = 0 const now = dayjs.utc().format() for (const item of items) { const stream = store.create(item) @@ -46,23 +44,16 @@ async function updateStreams(items = [], results = {}, origins = {}) { } } - if (buffer[stream.get('url')]) { - await db.streams.remove({ _id: stream.get('_id') }) - removed++ - } else { - buffer[stream.get('url')] = true - if (stream.changed) { - stream.set('updated_at', { updated_at: now }) - await db.streams.update({ _id: stream.get('_id') }, stream.data()) - updated++ - } + if (stream.changed) { + stream.set('updated_at', { updated_at: now }) + await db.streams.update({ _id: stream.get('_id') }, stream.data()) + updated++ } } db.streams.compact() logger.info(`updated ${updated} streams`) - logger.info(`removed ${removed} duplicates`) logger.info('done') }