Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private startQueues() {
log.verbose('PadchatRpc', 'startQueues()')
/**
* Throttle for 10 seconds
*/
this.throttleQueue = new ThrottleQueue(1000 * 10)
/**
* Debounce for 20 seconds
*/
this.debounceQueue = new DebounceQueue(1000 * 10 * 2)
/**
* Throttle for 5 seconds for the `logout` event:
* we should only fire once for logout,
* but the server will send many events of 'logout'
*/
this.logoutThrottleQueue = new ThrottleQueue(1000 * 5)
this.initHeartbeat()
if (this.logoutThrottleSubscription) {
throw new Error('this.logoutThrottleSubscription exist')
} else {
this.logoutThrottleSubscription = this.logoutThrottleQueue.subscribe(async msg => {
await this.reset(msg)
})