Skip to content

Commit

Permalink
Removed polling in favor of using updateRuneUtxoBalances directly (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
summraznboi authored Apr 18, 2024
1 parent c156879 commit e7bbfc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 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.1-alpha",
"version": "0.9.2-alpha",
"description": "",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
11 changes: 4 additions & 7 deletions src/indexer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export class RunestoneIndexer {
private readonly _storage: RunestoneStorage;
private readonly _rpc: BitcoinRpcClient;
private readonly _network: Network;
private readonly _pollIntervalMs: number | null;

private _started: boolean = false;
private _updateInProgress: Promise<void> | null = null;
Expand All @@ -21,8 +20,6 @@ export class RunestoneIndexer {
this._rpc = options.bitcoinRpcClient;
this._storage = options.storage;
this._network = options.network;
this._pollIntervalMs =
options.pollIntervalMs !== null ? Math.max(options.pollIntervalMs ?? 10000, 0) : null;
}

async start(): Promise<void> {
Expand All @@ -34,10 +31,6 @@ export class RunestoneIndexer {

this._started = true;

if (this._pollIntervalMs !== null) {
this._intervalId = setInterval(() => this.updateRuneUtxoBalances(), this._pollIntervalMs);
}

if (this._network === Network.MAINNET) {
this._storage.seedEtchings([
{
Expand Down Expand Up @@ -68,6 +61,10 @@ export class RunestoneIndexer {
}

async updateRuneUtxoBalances(): Promise<void> {
if (!this._started) {
throw new Error('Runestone indexer is not started');
}

if (this._updateInProgress) {
return;
}
Expand Down

0 comments on commit e7bbfc2

Please sign in to comment.