Skip to content

Commit

Permalink
Fix reindex module (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoozo authored Dec 6, 2024
1 parent 090d5d4 commit c607e0d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Missing API dependency when using reindex

## [5.2.0] - 2024-11-28
### Added
- Support for historical indexing by timestamp as well as block height
Expand Down
30 changes: 28 additions & 2 deletions packages/node/src/subcommands/reindex.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ import {
PoiService,
NodeConfig,
storeModelFactory,
ConnectionPoolService,
ConnectionPoolStateManager,
} from '@subql/node-core';
import { Sequelize } from '@subql/x-sequelize';
import { ConfigureModule } from '../configure/configure.module';
import { SubqueryProject } from '../configure/SubqueryProject';
import { EthereumApiService } from '../ethereum';
import { EthereumApiConnection } from '../ethereum/api.connection';
import { DsProcessorService } from '../indexer/ds-processor.service';
import { DynamicDsService } from '../indexer/dynamic-ds.service';
import { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';
Expand All @@ -40,10 +45,31 @@ import { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';
useClass: DynamicDsService,
},
DsProcessorService,
ConnectionPoolStateManager,
ConnectionPoolService,
{
// Used to work with DI for unfinalizedBlocksService but not used with reindex
provide: ApiService,
useFactory: () => undefined,
useFactory: async (
project: SubqueryProject,
connectionPoolService: ConnectionPoolService<EthereumApiConnection>,
eventEmitter: EventEmitter2,
nodeConfig: NodeConfig,
) => {
const apiService = new EthereumApiService(
project,
connectionPoolService,
eventEmitter,
nodeConfig,
);
await apiService.init();
return apiService;
},
inject: [
'ISubqueryProject',
ConnectionPoolService,
EventEmitter2,
NodeConfig,
],
},
SchedulerRegistry,
],
Expand Down

0 comments on commit c607e0d

Please sign in to comment.