Added debounce time constant

This commit is contained in:
Douglas Barone 2020-11-19 11:38:44 -04:00
parent 259678e100
commit 210e5a9b93

View File

@ -3,6 +3,8 @@ import { getOnlineWifiDevices as getOnlineCiscoDevices } from './ciscoController
import prisma from '../prisma'
const DEBOUNCE_TIME_MS = 10000
let updating = false
async function updateDBWithOnlineDevices() {
@ -48,13 +50,13 @@ async function updateDBWithOnlineDevices() {
setTimeout(() => {
updating = false
}, 10000)
}, DEBOUNCE_TIME_MS)
// TODO: pubsub
return onlineDevices.length
} catch (e) {
console.log('Error updating DB: ', e)
return -2
return 0
}
}