Update cleanup.js
This commit is contained in:
parent
d00e2e5e38
commit
6a96f23040
@ -9,12 +9,12 @@ async function main() {
|
|||||||
let removed = 0
|
let removed = 0
|
||||||
const buffer = {}
|
const buffer = {}
|
||||||
for (const stream of streams) {
|
for (const stream of streams) {
|
||||||
const duplicate = buffer[stream.channel_id]
|
const duplicate = buffer[stream.channel]
|
||||||
if (duplicate && ['offline', 'timeout'].includes(stream.status.code)) {
|
if (duplicate && !stream.is_online) {
|
||||||
await db.streams.remove({ _id: stream._id })
|
await db.streams.remove({ _id: stream._id })
|
||||||
removed++
|
removed++
|
||||||
} else {
|
} else {
|
||||||
buffer[stream.channel_id] = stream
|
buffer[stream.channel] = stream
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
db.streams.compact()
|
db.streams.compact()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user