Skip to content

Commit

Permalink
fix poi Inject issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yoozo committed Nov 4, 2024
1 parent c53eaf3 commit fe23d05
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/node-core/src/configure/NodeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export class NodeConfig<C extends IConfig = IConfig> implements IConfig {
return this._config.monitorFileSize ?? this._config.proofOfIndex ? defaultMonitorFileSize : 0;
}

get cacheDisable(): boolean {
get enableCache(): boolean {
return this._config.enableCache ?? true;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/node-core/src/indexer/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
},
Expand Down
6 changes: 1 addition & 5 deletions packages/node-core/src/indexer/poi/poi.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>(PoiService);
Expand Down
5 changes: 1 addition & 4 deletions packages/node-core/src/indexer/poi/poi.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fe23d05

Please sign in to comment.