From 0220c1675886a187b8219fcc929145cc60b068f6 Mon Sep 17 00:00:00 2001 From: zhl Date: Thu, 17 Dec 2020 13:08:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=AF=E5=8A=A8=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecosystem.config.js | 5 +++-- src/utils/array.util.ts | 16 ++++++++++++++++ tsconfig.json | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ecosystem.config.js b/ecosystem.config.js index af8ed83..74f4e83 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -1,4 +1,5 @@ -const os = require('os'); + +let config = require('./config/config.json'); module.exports = { apps: [ { @@ -8,7 +9,7 @@ module.exports = { instances : 1, // scale this up if the proxy becomes the bottleneck exec_mode : 'cluster', env: { - REDIS_URL: "redis://127.0.0.1:6379/15" + REDIS_URL: config.redis } }, { diff --git a/src/utils/array.util.ts b/src/utils/array.util.ts index dfda79e..55f10f9 100644 --- a/src/utils/array.util.ts +++ b/src/utils/array.util.ts @@ -8,6 +8,22 @@ let arrUtil = { ; } }, + /** + * 移除数组index位置的元素 + * @param arr + * @param index + */ + spliceOne(arr: any[], index: number): boolean { + if (index === -1 || index >= arr.length) { + return false; + } + const len = arr.length - 1; + for (let i = index; i < len; i++) { + arr[i] = arr[i + 1]; + } + arr.length = len; + return true; + }, /** * 检查数组中是否含有另外一个object * @param arr 目标数组 diff --git a/tsconfig.json b/tsconfig.json index fd67a3e..8a0aa2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ }, "files": [ "src/index.ts", + "src/robot.ts", "src/global.d.ts" ], "compilerOptions": {