Skip to content

Commit a61348a

Browse files
committed
chore: Remove unused imports and code
1 parent 45de507 commit a61348a

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

src/app.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { Injectable } from '@nestjs/common';
22
import { ModuleRef } from '@nestjs/core';
33
import { AbstractService } from './_common/abstracts/abstract.service';
4-
import { PackageJson } from 'types-package-json';
4+
// import { PackageJson } from 'types-package-json';
55
//import { readFileSync } from 'node:fs';
66
//import { pick } from 'radash';
77

88
@Injectable()
99
export class AppService extends AbstractService {
10-
protected package: Partial<PackageJson>;
10+
// protected package: Partial<PackageJson>;
1111

1212
public constructor(protected moduleRef: ModuleRef) {
1313
super({ moduleRef });
1414
//this.package = JSON.parse(readFileSync('package.json', 'utf-8'));
1515
}
1616

17-
// public getInfo(): Partial<PackageJson> {
17+
// public getInfo(): Partial<PackageJson> {
1818
// return pick(this.package, ['name', 'version']);
19-
// }
19+
// }
2020
}

src/backend-runner/_executors/catch-all.executor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface ValidationRecursive {
1717
export class CatchAllExecutor implements ExecutorInterface {
1818
public constructor(public service: BackendRunnerService) { }
1919

20-
public async execute({ job }): Promise<ExecutorExecuteResponseInterface> {
20+
public async execute({ job }: { job: Job<any, any, string> }): Promise<ExecutorExecuteResponseInterface> {
2121
let status = 0;
2222
const data = [];
2323

@@ -36,6 +36,7 @@ export class CatchAllExecutor implements ExecutorInterface {
3636

3737
if (backend.actions[job.name].onError === 'stop' && result.status !== 0) {
3838
this.service.logger.log('stop on Error');
39+
await job.updateProgress(100);
3940
break;
4041
}
4142

src/backend-runner/backend-runner.service.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import { ActionType } from './_enum/action-type.enum';
1010
import { ExecutorConfigInterface } from '~/_common/interfaces/executor-config.interface';
1111
import Redis from 'ioredis';
1212
import { DumpPackageConfigExecutor } from './_executors/dump-package-config.executor';
13-
import { PackageJson } from 'types-package-json';
13+
// import { PackageJson } from 'types-package-json';
1414
import { readFileSync } from 'node:fs';
1515
//import { PackageJson } from 'types-package-json';
1616
//import { readFileSync } from 'node:fs';
1717

1818
@Injectable()
1919
export class BackendRunnerService implements OnApplicationBootstrap, OnModuleInit {
20-
protected _package: Partial<PackageJson>;
20+
protected _package: Partial<any>;
2121
private readonly _logger = new Logger(BackendRunnerService.name);
2222

2323
protected executors: Map<string, ExecutorInterface> = new Map<string, ExecutorInterface>();
@@ -30,7 +30,7 @@ export class BackendRunnerService implements OnApplicationBootstrap, OnModuleIni
3030
return this._logger;
3131
}
3232

33-
public get packageJson(): Partial<PackageJson> {
33+
public get packageJson(): Partial<any> {
3434
return this._package;
3535
}
3636

@@ -43,13 +43,14 @@ export class BackendRunnerService implements OnApplicationBootstrap, OnModuleIni
4343
private readonly _backendsConfig: BackendConfigService,
4444
@InjectRedis() private readonly redis: Redis,
4545
) {
46-
try {
47-
48-
this._package = JSON.parse(readFileSync('package.json', 'utf-8'));
49-
} catch (e) {
50-
this._logger.error('Error reading package.json file: ', e);
51-
this._package = {};
52-
}
46+
console.log('pkg', (process as any).pkg)
47+
this._package = {};
48+
// try {
49+
// this._package = JSON.parse(readFileSync('package.json', 'utf-8'));
50+
// } catch (e) {
51+
// this._logger.error('Error reading package.json file: ', e);
52+
// this._package = {};
53+
// }
5354
}
5455

5556
public async onModuleInit() {
@@ -77,13 +78,14 @@ export class BackendRunnerService implements OnApplicationBootstrap, OnModuleIni
7778
this.logger.verbose(`Job ${job.name} executed with status ${result.status}`);
7879

7980
if (result.status !== 0) {
80-
this.logger.error(`Job ${job.name} failed with status ${result.status}`);
8181
const errMsg = []
82+
this.logger.error(`Job ${job.name} failed with status ${result.status}`);
83+
8284
for (const data of result.data) {
8385
errMsg.push(data?.error?.message || 'No error message');
8486
}
8587

86-
throw new UnrecoverableError(`Job ${job.name} failed with status ${result.status}: ${errMsg.join(', ')}`);
88+
return result;
8789
}
8890

8991
this.logger.log(`Job ${job.name} success with status ${result.status}`);

0 commit comments

Comments
 (0)