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'
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user