vault creation loop bugfix
This commit is contained in:
10
src/misc.js
10
src/misc.js
@@ -16,9 +16,9 @@ export class SingletonCoroutine {
|
||||
|
||||
invoke(/*arguments*/) {
|
||||
this.args = arguments
|
||||
if( this.timeout !== null )
|
||||
clearTimeout(this.timeout)
|
||||
this.timeout = setTimeout(this.onTimeout, this.delay, this)
|
||||
console.log('invoke', arguments)
|
||||
if( this.timeout === null )
|
||||
this.timeout = setTimeout(this.onTimeout, this.delay, this)
|
||||
}
|
||||
|
||||
async onTimeout(self) {
|
||||
@@ -26,8 +26,10 @@ export class SingletonCoroutine {
|
||||
await self.f(...self.args)
|
||||
}
|
||||
catch (e) {
|
||||
if( self.retry )
|
||||
if( self.retry ) {
|
||||
console.log('retrying', this.f, 'due to error', e)
|
||||
self.invoke(self.args)
|
||||
}
|
||||
else
|
||||
console.error(e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user