vault creation loop bugfix

This commit is contained in:
Tim Olson
2023-12-28 18:26:58 -04:00
parent a8de41af12
commit 9c882ab283
3 changed files with 13 additions and 9 deletions

View File

@@ -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)
}