1 | "use strict";
|
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7 | };
|
8 | var __metadata = (this && this.__metadata) || function (k, v) {
|
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10 | };
|
11 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12 | return new (P || (P = Promise))(function (resolve, reject) {
|
13 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
14 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
15 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
16 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
17 | });
|
18 | };
|
19 | Object.defineProperty(exports, "__esModule", { value: true });
|
20 | const typedi_1 = require("typedi");
|
21 | const Workers_1 = require("../libs/worker/Workers");
|
22 | const Log_1 = require("../libs/logging/Log");
|
23 | class WorkerCommand {
|
24 | constructor() {
|
25 | this.command = 'worker';
|
26 | this.aliases = 'w';
|
27 | this.describe = 'Handle worker';
|
28 | }
|
29 | builder(yargs) {
|
30 | return yargs;
|
31 | }
|
32 | handler(argv) {
|
33 | return __awaiter(this, void 0, void 0, function* () {
|
34 |
|
35 | if (this.workers.workers.length > 0) {
|
36 | Log_1.Log.info(this.workers.workers.length + ' workers are online.');
|
37 | yield new Promise(resolve => {
|
38 | });
|
39 | }
|
40 | else {
|
41 | console.log('No workers found.');
|
42 | }
|
43 | });
|
44 | }
|
45 | }
|
46 | __decorate([
|
47 | typedi_1.Inject(Workers_1.Workers.NAME),
|
48 | __metadata("design:type", Workers_1.Workers)
|
49 | ], WorkerCommand.prototype, "workers", void 0);
|
50 | exports.WorkerCommand = WorkerCommand;
|
51 |
|
52 |
|