Skip to content

Commit

Permalink
Remove BlockedQueue, fix more lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Jul 29, 2022
1 parent 6b972b1 commit 38e6863
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 200 deletions.
79 changes: 0 additions & 79 deletions packages/node-core/src/indexer/BlockedQueue.spec.ts

This file was deleted.

64 changes: 0 additions & 64 deletions packages/node-core/src/indexer/BlockedQueue.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/node-core/src/indexer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
export * from './benchmark.service';
export * from './entities';
export * from './PoiBlock';
export * from './BlockedQueue';
export * from './types';
export * from './StoreOperations';
export * from './store.service';
Expand Down
8 changes: 4 additions & 4 deletions packages/node-core/src/utils/batch-size.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright 2020-2022 OnFinality Limited authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { getHeapStatistics } from 'v8';
import { getYargsOption } from '../yargs';
import { getLogger } from '../logger';
import {getHeapStatistics} from 'v8';
import {getLogger} from '../logger';
import {getYargsOption} from '../yargs';

const HIGH_THRESHOLD = 0.85;
const LOW_THRESHOLD = 0.6;

const { argv } = getYargsOption();
const {argv} = getYargsOption();
const logger = getLogger('memory');

export function checkMemoryUsage(batchSizeScale: number): number {
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { Module } from '@nestjs/common';
import { EventEmitterModule } from '@nestjs/event-emitter';
import { ScheduleModule } from '@nestjs/schedule';
import { DbModule } from '@subql/node-core/db';
import { FetchModule } from './indexer/fetch.module';
import { ConfigureModule } from './configure/configure.module';
import { FetchModule } from './indexer/fetch.module';
import { MetaModule } from './meta/meta.module';

@Module({
Expand Down
8 changes: 2 additions & 6 deletions packages/node/src/indexer/api.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
import { INestApplication } from '@nestjs/common';
import { EventEmitterModule } from '@nestjs/event-emitter';
import { Test } from '@nestjs/testing';
import {
BlockHash,
RuntimeVersion,
SignedBlock,
} from '@polkadot/types/interfaces';
import { BlockHash, RuntimeVersion } from '@polkadot/types/interfaces';
import { delay } from '@subql/node-core/utils';
import { SubstrateBlock } from '@subql/types';
import { GraphQLSchema } from 'graphql';
import { SubqueryProject } from '../configure/SubqueryProject';
import { delay } from '@subql/node-core/utils';
import { wrapBlock } from '../utils/substrate';
import { ApiService } from './api.service';

Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/indexer/fetch.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
SubstrateDatasourceKind,
SubstrateHandlerKind,
} from '@subql/common-substrate';
import { GraphQLSchema } from 'graphql';
import { NodeConfig } from '@subql/node-core/configure';
import { IndexerEvent } from '@subql/node-core/events';
import { GraphQLSchema } from 'graphql';
import { SubqueryProject } from '../configure/SubqueryProject';
import { calcInterval, fetchBlocksBatches } from '../utils/substrate';
import { ApiService } from './api.service';
Expand Down
10 changes: 2 additions & 8 deletions packages/node/src/indexer/fetch.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,17 @@ import {
SubstrateDataSource,
SubstrateRuntimeHandlerFilter,
} from '@subql/common-substrate';
import {
getYargsOption,
getLogger,
profiler,
profilerWrap,
} from '@subql/node-core';
import { getYargsOption, getLogger, profiler } from '@subql/node-core';
import { NodeConfig } from '@subql/node-core/configure';
import { IndexerEvent } from '@subql/node-core/events';
import { BlockedQueue } from '@subql/node-core/indexer';
import { delay, checkMemoryUsage } from '@subql/node-core/utils';
import {
DictionaryQueryEntry,
SubstrateBlock,
SubstrateCustomHandler,
} from '@subql/types';
import { MetaData } from '@subql/utils';
import { isUndefined, range, sortBy, uniqBy } from 'lodash';
import { range, sortBy, uniqBy } from 'lodash';
import { SubqlProjectDs, SubqueryProject } from '../configure/SubqueryProject';
import { isBaseHandler, isCustomHandler } from '../utils/project';
import * as SubstrateUtil from '../utils/substrate';
Expand Down
2 changes: 0 additions & 2 deletions packages/node/src/indexer/indexer.manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

import { EventEmitter2 } from '@nestjs/event-emitter';
import { SchedulerRegistry } from '@nestjs/schedule';
import {
SubstrateDatasourceKind,
SubstrateHandlerKind,
Expand All @@ -19,7 +18,6 @@ import { DynamicDsService } from './dynamic-ds.service';
import { IndexerManager } from './indexer.manager';
import { ProjectService } from './project.service';
import { SandboxService } from './sandbox.service';
import { FetchService } from './fetch.service';

jest.mock('sequelize', () => {
const mSequelize = {
Expand Down
35 changes: 3 additions & 32 deletions packages/node/src/indexer/project.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
// SPDX-License-Identifier: Apache-2.0

import { Test } from '@nestjs/testing';
import { GraphQLSchema } from 'graphql';
import { Sequelize } from 'sequelize';
import { NodeConfig } from '@subql/node-core/configure';
import { SubqueryProject } from '../configure/SubqueryProject';
import { DbModule } from '@subql/node-core/db';
import { SubqueryRepo } from '@subql/node-core/entities';
import { IndexerManager } from './indexer.manager';
import { GraphQLSchema } from 'graphql';
import { Sequelize } from 'sequelize';
import { SubqueryProject } from '../configure/SubqueryProject';
import { ProjectService } from './project.service';

function testSubqueryProject(): SubqueryProject {
Expand Down Expand Up @@ -57,34 +56,6 @@ const prepare = async (): Promise<ProjectService> => {
},
inject: [Sequelize, SubqueryProject, 'Subquery'],
},
// {
// provide: IndexerManager,
// useFactory: (
// sequelize: Sequelize,
// project: SubqueryProject,
// projectService: ProjectService,
// subqueryRepo: SubqueryRepo,
// ) => {
// const indexerManager = new IndexerManager(
// undefined,
// undefined,
// undefined,
// undefined,
// undefined,
// sequelize,
// project,
// undefined,
// undefined,
// undefined,
// undefined,
// subqueryRepo,
// undefined,
// projectService,
// );
// return indexerManager;
// },
// inject: [Sequelize, SubqueryProject, ProjectService, 'Subquery'],
// },
],
imports: [
DbModule.forRoot({
Expand Down
3 changes: 1 addition & 2 deletions packages/node/src/indexer/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import assert from 'assert';
import fs from 'fs';
import { off } from 'process';
import { isMainThread } from 'worker_threads';
import { Inject, Injectable } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
Expand All @@ -17,7 +16,7 @@ import {
MetadataRepo,
} from '@subql/node-core/indexer/entities';
import { getAllEntitiesRelations } from '@subql/utils';
import { QueryTypes, Sequelize, Transaction } from 'sequelize';
import { QueryTypes, Sequelize } from 'sequelize';
import { SubqlProjectDs, SubqueryProject } from '../configure/SubqueryProject';
import { ApiService } from './api.service';
import { DsProcessorService } from './ds-processor.service';
Expand Down

0 comments on commit 38e6863

Please sign in to comment.