Cleanup of clearTimeout and nonasync funcs
This commit is contained in:
parent
8fda4a8d61
commit
7bc4801289
1 changed files with 6 additions and 6 deletions
|
|
@ -98,7 +98,7 @@ class PlejdService extends EventEmitter {
|
||||||
};
|
};
|
||||||
|
|
||||||
clearInterval(this.pingRef);
|
clearInterval(this.pingRef);
|
||||||
clearInterval(this.writeQueueRef);
|
clearTimeout(this.writeQueueRef);
|
||||||
console.log('init()');
|
console.log('init()');
|
||||||
|
|
||||||
const bluez = await this.bus.getProxyObject(BLUEZ_SERVICE_NAME, '/');
|
const bluez = await this.bus.getProxyObject(BLUEZ_SERVICE_NAME, '/');
|
||||||
|
|
@ -369,8 +369,8 @@ class PlejdService extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// auth done, start ping
|
// auth done, start ping
|
||||||
await this.startPing();
|
this.startPing();
|
||||||
await this.startWriteQueue();
|
this.startWriteQueue();
|
||||||
|
|
||||||
// After we've authenticated, we need to hook up the event listener
|
// After we've authenticated, we need to hook up the event listener
|
||||||
// for changes to lastData.
|
// for changes to lastData.
|
||||||
|
|
@ -414,7 +414,7 @@ class PlejdService extends EventEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async startPing() {
|
startPing() {
|
||||||
console.log('startPing()');
|
console.log('startPing()');
|
||||||
clearInterval(this.pingRef);
|
clearInterval(this.pingRef);
|
||||||
|
|
||||||
|
|
@ -460,9 +460,9 @@ class PlejdService extends EventEmitter {
|
||||||
this.emit('pingSuccess', pong[0]);
|
this.emit('pingSuccess', pong[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async startWriteQueue() {
|
startWriteQueue() {
|
||||||
console.log('startWriteQueue()');
|
console.log('startWriteQueue()');
|
||||||
clearInterval(this.writeQueueRef);
|
clearTimeout(this.writeQueueRef);
|
||||||
|
|
||||||
this.writeQueueRef = setTimeout(() => this.runWriteQueue(), this.writeQueueWaitTime);
|
this.writeQueueRef = setTimeout(() => this.runWriteQueue(), this.writeQueueWaitTime);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue