fix: don't drop pings out of the table
This commit is contained in:
parent
8cf68e480a
commit
16761b0744
1 changed files with 0 additions and 7 deletions
|
|
@ -714,16 +714,9 @@ const enqueueRecordPing = ping => {
|
||||||
pendingRecordPings.set(ping.deviceId, ping)
|
pendingRecordPings.set(ping.deviceId, ping)
|
||||||
}
|
}
|
||||||
|
|
||||||
// from @sindresorhus/is-empty-iterable
|
|
||||||
const isEmptyIterable = iter => {
|
|
||||||
for (const _ of iter) return false
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
const batchRecordPendingPings = () => {
|
const batchRecordPendingPings = () => {
|
||||||
const pings = pendingRecordPings.values()
|
const pings = pendingRecordPings.values()
|
||||||
pendingRecordPings = new Map()
|
pendingRecordPings = new Map()
|
||||||
if (isEmptyIterable(pings)) return Promise.resolve()
|
|
||||||
|
|
||||||
return db.task(async t => {
|
return db.task(async t => {
|
||||||
for (const { deviceId, last_online, version, model } of pings) {
|
for (const { deviceId, last_online, version, model } of pings) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue