diff --git a/packages/node-core/src/configure/NodeConfig.ts b/packages/node-core/src/configure/NodeConfig.ts index 8ba6a39339..c8ecd3baf2 100644 --- a/packages/node-core/src/configure/NodeConfig.ts +++ b/packages/node-core/src/configure/NodeConfig.ts @@ -329,7 +329,7 @@ export class NodeConfig implements IConfig { return this._config.monitorFileSize ?? this._config.proofOfIndex ? defaultMonitorFileSize : 0; } - get cacheDisable(): boolean { + get enableCache(): boolean { return this._config.enableCache ?? true; } diff --git a/packages/node-core/src/indexer/core.module.ts b/packages/node-core/src/indexer/core.module.ts index a9aefc9b30..1f4cb87c3f 100644 --- a/packages/node-core/src/indexer/core.module.ts +++ b/packages/node-core/src/indexer/core.module.ts @@ -37,9 +37,9 @@ import {IStoreModelProvider, PlainStoreModelService, StoreCacheService} from './ schedulerRegistry: SchedulerRegistry, sequelize: Sequelize ): IStoreModelProvider => { - return nodeConfig.cacheDisable - ? new PlainStoreModelService(sequelize, nodeConfig) - : new StoreCacheService(sequelize, nodeConfig, eventEmitter, schedulerRegistry); + return nodeConfig.enableCache + ? new StoreCacheService(sequelize, nodeConfig, eventEmitter, schedulerRegistry) + : new PlainStoreModelService(sequelize, nodeConfig); }, inject: [NodeConfig, EventEmitter2, SchedulerRegistry, Sequelize], }, diff --git a/packages/node-core/src/indexer/poi/poi.service.spec.ts b/packages/node-core/src/indexer/poi/poi.service.spec.ts index 8fc787f900..16cb651933 100644 --- a/packages/node-core/src/indexer/poi/poi.service.spec.ts +++ b/packages/node-core/src/indexer/poi/poi.service.spec.ts @@ -72,11 +72,7 @@ describe('PoiService', () => { } as any; const module: TestingModule = await Test.createTestingModule({ - providers: [ - PoiService, - {provide: NodeConfig, useValue: nodeConfig}, - {provide: StoreCacheService, useValue: storeCache}, - ], + providers: [PoiService, {provide: 'IStoreModelProvider', useValue: storeCache}], }).compile(); service = module.get(PoiService); diff --git a/packages/node-core/src/indexer/poi/poi.service.ts b/packages/node-core/src/indexer/poi/poi.service.ts index 67bfcd7e15..9f0fb8b890 100644 --- a/packages/node-core/src/indexer/poi/poi.service.ts +++ b/packages/node-core/src/indexer/poi/poi.service.ts @@ -24,10 +24,7 @@ export class PoiService implements OnApplicationShutdown { private isShutdown = false; private _poiRepo?: IPoi; - constructor( - protected readonly nodeConfig: NodeConfig, - @Inject('IStoreModelProvider') private storeModelProvider: IStoreModelProvider - ) {} + constructor(@Inject('IStoreModelProvider') private storeModelProvider: IStoreModelProvider) {} onApplicationShutdown(): void { this.isShutdown = true;