Added debounce time constant
This commit is contained in:
parent
259678e100
commit
210e5a9b93
|
@ -3,6 +3,8 @@ import { getOnlineWifiDevices as getOnlineCiscoDevices } from './ciscoController
|
||||||
|
|
||||||
import prisma from '../prisma'
|
import prisma from '../prisma'
|
||||||
|
|
||||||
|
const DEBOUNCE_TIME_MS = 10000
|
||||||
|
|
||||||
let updating = false
|
let updating = false
|
||||||
|
|
||||||
async function updateDBWithOnlineDevices() {
|
async function updateDBWithOnlineDevices() {
|
||||||
|
@ -48,13 +50,13 @@ async function updateDBWithOnlineDevices() {
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
updating = false
|
updating = false
|
||||||
}, 10000)
|
}, DEBOUNCE_TIME_MS)
|
||||||
|
|
||||||
// TODO: pubsub
|
// TODO: pubsub
|
||||||
return onlineDevices.length
|
return onlineDevices.length
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error updating DB: ', e)
|
console.log('Error updating DB: ', e)
|
||||||
return -2
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user