Skip to content

Commit

Permalink
fix(indexer): run hub indexer in parallel
Browse files Browse the repository at this point in the history
Signed-off-by: james-a-morris <[email protected]>
  • Loading branch information
james-a-morris committed Oct 4, 2024
1 parent 4fdeeea commit 3bf1fcc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/indexer/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export async function Main(config: parseEnv.Config, logger: winston.Logger) {
new RedisCache(redis),
logger,
);
await hubPoolIndexer.start();

let exitRequested = false;
process.on("SIGINT", () => {
Expand All @@ -109,10 +108,12 @@ export async function Main(config: parseEnv.Config, logger: winston.Logger) {
at: "Indexer#Main",
});
// start all indexers in parallel, will wait for them to complete, but they all loop independently
const [bundleResults, ...spokeResults] = await Promise.allSettled([
bundleProcessor.start(10),
...spokePoolIndexers.map((s) => s.start(10)),
]);
const [bundleResults, hubPoolResult, ...spokeResults] =
await Promise.allSettled([
bundleProcessor.start(10),
hubPoolIndexer.start(),
...spokePoolIndexers.map((s) => s.start(10)),
]);

logger.info({
at: "Indexer#Main",
Expand All @@ -122,6 +123,7 @@ export async function Main(config: parseEnv.Config, logger: winston.Logger) {
(r) => r.status === "fulfilled",
),
bundleProcessorRunSuccess: bundleResults.status === "fulfilled",
hubPoolIndexerRunSuccess: hubPoolResult.status === "fulfilled",
},
});

Expand Down

0 comments on commit 3bf1fcc

Please sign in to comment.