Skip to content

Commit

Permalink
chore: update hardcode constant variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
perfogic committed Oct 3, 2024
1 parent 0d4c3f8 commit 85dc771
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
13 changes: 7 additions & 6 deletions packages/orchestrator/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ export const SCAN_MEMPOOL_CHUNK_DELAY = 1000; // 1 second
export const RELAY_DEPOSIT_BLOCKS_SIZE = 200; // 10 blocks
export const RETRY_DELAY = 1000; // 1 second
export const ITERATION_DELAY = {
RELAY_HEADER: 2000,
RELAY_DEPOSIT: 3000,
RELAY_RECOVERY: 3000,
RELAY_CHECKPOINT: 5000,
RELAY_CHECKPOINT_CONF: 10000,
RELAY_SIGNATURES: 10000,
RELAY_HEADER_BATCH_DELAY: 500,
RELAY_HEADER_INTERVAL: 10000,
RELAY_DEPOSIT_INTERVAL: 3000,
RELAY_RECOVERY_INTERVAL: 3000,
RELAY_CHECKPOINT_INTERVAL: 5000,
RELAY_CHECKPOINT_CONF_INTERVAL: 10000,
RELAY_SIGNATURES_INTERVAL: 10000,
};
Empty file.
12 changes: 7 additions & 5 deletions packages/orchestrator/src/services/relayer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ class RelayerService implements RelayerInterface {

if (fullNodeHash !== sideChainHash) {
await this.relayHeaderBatch(fullNodeHash, sideChainHash);
// Delay between headers
await setTimeout(ITERATION_DELAY.RELAY_HEADER_BATCH_DELAY);
continue;
}

Expand All @@ -133,7 +135,7 @@ class RelayerService implements RelayerInterface {
} catch (err) {
this.logger.error(`[RELAY_HEADER] ${err?.message}`);
}
await setTimeout(ITERATION_DELAY.RELAY_HEADER);
await setTimeout(ITERATION_DELAY.RELAY_HEADER_INTERVAL);
}
}

Expand Down Expand Up @@ -321,7 +323,7 @@ class RelayerService implements RelayerInterface {
this.logger.error(`[RELAY_DEPOSIT] ${err?.message}`);
}
}
await setTimeout(ITERATION_DELAY.RELAY_DEPOSIT);
await setTimeout(ITERATION_DELAY.RELAY_DEPOSIT_INTERVAL);
}
}

Expand Down Expand Up @@ -548,7 +550,7 @@ class RelayerService implements RelayerInterface {
} catch (err) {
this.logger.error(`[RELAY_RECOVERY_DEPOSIT] ${err?.message}`);
}
await setTimeout(ITERATION_DELAY.RELAY_RECOVERY);
await setTimeout(ITERATION_DELAY.RELAY_RECOVERY_INTERVAL);
}
}

Expand All @@ -575,7 +577,7 @@ class RelayerService implements RelayerInterface {
} catch (err) {
this.logger.error(`[RELAY_CHECKPOINT] ${err?.message}`);
}
await setTimeout(ITERATION_DELAY.RELAY_CHECKPOINT);
await setTimeout(ITERATION_DELAY.RELAY_CHECKPOINT_INTERVAL);
}
}

Expand Down Expand Up @@ -673,7 +675,7 @@ class RelayerService implements RelayerInterface {
this.logger.error(`[RELAY_CHECKPOINT_CONF] ${err?.message}`);
}
}
await setTimeout(ITERATION_DELAY.RELAY_CHECKPOINT_CONF);
await setTimeout(ITERATION_DELAY.RELAY_CHECKPOINT_CONF_INTERVAL);
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/orchestrator/src/services/signer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class SignerService implements RelayerInterface {
let previousIndex = buildingIndex - 1;

if (previousIndex < 0) {
await setTimeout(ITERATION_DELAY.RELAY_SIGNATURES);
await setTimeout(ITERATION_DELAY.RELAY_SIGNATURES_INTERVAL);
continue;
}

Expand Down Expand Up @@ -132,7 +132,7 @@ class SignerService implements RelayerInterface {
);
}

await setTimeout(ITERATION_DELAY.RELAY_SIGNATURES);
await setTimeout(ITERATION_DELAY.RELAY_SIGNATURES_INTERVAL);
}
}

Expand Down Expand Up @@ -227,7 +227,7 @@ class SignerService implements RelayerInterface {
this.logger.error(`[START_RECOVERY_SIGNING] ${err?.message}`);
}

await setTimeout(ITERATION_DELAY.RELAY_SIGNATURES);
await setTimeout(ITERATION_DELAY.RELAY_SIGNATURES_INTERVAL);
}
}

Expand Down

0 comments on commit 85dc771

Please sign in to comment.