mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 10:00:05 -04:00
Update cleanup.js
This commit is contained in:
parent
d00e2e5e38
commit
6a96f23040
1 changed files with 3 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue