Skip to content

Commit

Permalink
Fix unhandled promise rejection (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
summraznboi authored Apr 18, 2024
1 parent e7bbfc2 commit 462f33b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magiceden-oss/runestone-lib",
"version": "0.9.2-alpha",
"version": "0.9.3-alpha",
"description": "",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
14 changes: 4 additions & 10 deletions src/indexer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export class RunestoneIndexer {
private readonly _network: Network;

private _started: boolean = false;
private _updateInProgress: Promise<void> | null = null;
private _intervalId: NodeJS.Timeout | null = null;
private _updateInProgress: boolean = false;

constructor(options: RunestoneIndexerOptions) {
this._rpc = options.bitcoinRpcClient;
Expand Down Expand Up @@ -51,11 +50,6 @@ export class RunestoneIndexer {
return;
}

if (this._intervalId !== null) {
clearInterval(this._intervalId);
this._intervalId = null;
}

await this._storage.disconnect();
this._started = false;
}
Expand All @@ -69,11 +63,11 @@ export class RunestoneIndexer {
return;
}

this._updateInProgress = this.updateRuneUtxoBalancesImpl();
this._updateInProgress = true;
try {
await this._updateInProgress;
await this.updateRuneUtxoBalancesImpl();
} finally {
this._updateInProgress = null;
this._updateInProgress = false;
}
}

Expand Down

0 comments on commit 462f33b

Please sign in to comment.