fix: wrap sync in try/catch and unlock mutex in a finally
This commit is contained in:
parent
772d7eb21e
commit
09637948e7
|
@ -170,6 +170,7 @@ export default abstract class BaseClient extends EventEmitter {
|
|||
protected async _sync() {
|
||||
await this.syncMutex.acquire();
|
||||
|
||||
try {
|
||||
const currentPeriod = this.getCurrentPeriod();
|
||||
if (currentPeriod > this._latestPeriod) {
|
||||
if (!this.booted) {
|
||||
|
@ -180,9 +181,12 @@ export default abstract class BaseClient extends EventEmitter {
|
|||
this._latestPeriod = currentPeriod;
|
||||
this.emit("synced");
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} finally {
|
||||
this.syncMutex.release();
|
||||
}
|
||||
}
|
||||
|
||||
protected async subscribe(callback?: (ei: ExecutionInfo) => void) {
|
||||
setInterval(async () => {
|
||||
|
|
Loading…
Reference in New Issue