Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Nov 19, 2024
1 parent 0038ce5 commit d1ed5d8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/node-core/src/indexer/store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export class StoreService {
throw new Error(`Invalid value for historicalStateEnabled. Received "${value}"`);
}

if (value && multiChain) {
if ((value === true || value.toString() === 'height') && multiChain) {
throw new Error(
'Historical indexing by height is enabled and not compatible with multi-chain, to multi-chain index clear postgres schema and re-index project using --multichain'
);
Expand Down
4 changes: 2 additions & 2 deletions packages/node-core/src/indexer/worker/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ async function getStatus(): Promise<WorkerStatusResponse> {
};
}

async function fetchBlock<R extends Header /*FetchBlockResponse*/>(height: number, specVersion: number): Promise<R> {
async function fetchBlock(height: number, specVersion: number): ReturnType<(typeof workerService)['fetchBlock']> {
assert(workerService, 'Worker Not initialised');
return (workerService as unknown as BaseWorkerService<any, R>).fetchBlock(height, {specVersion});
return workerService.fetchBlock(height, {specVersion});
}

// eslint-disable-next-line @typescript-eslint/require-await
Expand Down
6 changes: 3 additions & 3 deletions packages/node-core/src/subcommands/reindex.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ export class ReindexService<P extends ISubqueryProject, DS extends BaseDataSourc

await this.dynamicDsService.init(this.metadataRepo);

const [height, timestamp] = await Promise.all([
this.metadataRepo.find('lastProcessedHeight'),
this.metadataRepo.find('lastProcessedBlockTimestamp'),
const {lastProcessedBlockTimestamp: timestamp, lastProcessedHeight: height} = await this.metadataRepo.findMany([
'lastProcessedHeight',
'lastProcessedBlockTimestamp',
]);

if (height === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class WorkerBlockDispatcherService
}

// const start = new Date();
return worker.fetchBlock<FetchBlockResponse>(height, blockSpecVersion);
return worker.fetchBlock(height, blockSpecVersion);
// const end = new Date();

// const waitTime = end.getTime() - start.getTime();
Expand Down

0 comments on commit d1ed5d8

Please sign in to comment.