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": {