Skip to content

Commit 462f33b

Browse files
authored
Fix unhandled promise rejection (#48)
1 parent e7bbfc2 commit 462f33b

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@magiceden-oss/runestone-lib",
3-
"version": "0.9.2-alpha",
3+
"version": "0.9.3-alpha",
44
"description": "",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/indexer/index.ts

+4-10
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ export class RunestoneIndexer {
1313
private readonly _network: Network;
1414

1515
private _started: boolean = false;
16-
private _updateInProgress: Promise<void> | null = null;
17-
private _intervalId: NodeJS.Timeout | null = null;
16+
private _updateInProgress: boolean = false;
1817

1918
constructor(options: RunestoneIndexerOptions) {
2019
this._rpc = options.bitcoinRpcClient;
@@ -51,11 +50,6 @@ export class RunestoneIndexer {
5150
return;
5251
}
5352

54-
if (this._intervalId !== null) {
55-
clearInterval(this._intervalId);
56-
this._intervalId = null;
57-
}
58-
5953
await this._storage.disconnect();
6054
this._started = false;
6155
}
@@ -69,11 +63,11 @@ export class RunestoneIndexer {
6963
return;
7064
}
7165

72-
this._updateInProgress = this.updateRuneUtxoBalancesImpl();
66+
this._updateInProgress = true;
7367
try {
74-
await this._updateInProgress;
68+
await this.updateRuneUtxoBalancesImpl();
7569
} finally {
76-
this._updateInProgress = null;
70+
this._updateInProgress = false;
7771
}
7872
}
7973

0 commit comments

Comments
 (0)