a lot of refactos
This commit is contained in:
@@ -83,6 +83,18 @@ export class PrepareQuorum {
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this.#cleanup()
|
||||
}
|
||||
|
||||
abortPending(result) {
|
||||
const resolve = this.resolve
|
||||
this.#cleanup()
|
||||
if(typeof(resolve) !== 'function') return(false)
|
||||
resolve(result)
|
||||
return(true)
|
||||
}
|
||||
|
||||
#cleanup() {
|
||||
if(this.timer) {
|
||||
clearTimeout(this.timer)
|
||||
this.timer = null
|
||||
@@ -96,7 +108,7 @@ export class PrepareQuorum {
|
||||
|
||||
#finish(result) {
|
||||
const resolve = this.resolve
|
||||
this.cancel()
|
||||
this.#cleanup()
|
||||
if(typeof(resolve) === 'function') resolve(result)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user