Update update.js

This commit is contained in:
Aleksandr Statciuk 2022-09-08 20:40:31 +03:00
parent 64fd476e5a
commit f409146eff
1 changed files with 6 additions and 4 deletions

View File

@ -49,11 +49,13 @@ async function updateStreams(items = [], results = {}, origins = {}) {
if (buffer[stream.get('url')]) {
await db.streams.remove({ _id: stream.get('_id') })
removed++
} else if (stream.changed) {
stream.set('updated_at', { updated_at: now })
await db.streams.update({ _id: stream.get('_id') }, stream.data())
} else {
buffer[stream.get('url')] = true
updated++
if (stream.changed) {
stream.set('updated_at', { updated_at: now })
await db.streams.update({ _id: stream.get('_id') }, stream.data())
updated++
}
}
}