koishi-plugin-pm2 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -0
- package/lib/index.js +9 -8
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -28,12 +28,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
33
|
PM2: () => PM2,
|
|
34
|
-
default: () =>
|
|
34
|
+
default: () => src_default
|
|
35
35
|
});
|
|
36
|
-
module.exports = __toCommonJS(
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
37
|
var import_koishi = require("koishi");
|
|
38
38
|
var import_path = require("path");
|
|
39
39
|
var import_API = __toESM(require("pm2/lib/API"));
|
|
@@ -139,9 +139,9 @@ function serialized(ctx, callback) {
|
|
|
139
139
|
}
|
|
140
140
|
__name(serialized, "serialized");
|
|
141
141
|
function throttle(ctx, callback, delay, noTrailing) {
|
|
142
|
-
const inner = ctx.throttle((
|
|
142
|
+
const inner = ctx.throttle((...args) => {
|
|
143
143
|
inner.result = callback(...args);
|
|
144
|
-
}
|
|
144
|
+
}, delay, noTrailing);
|
|
145
145
|
const wrapper = /* @__PURE__ */ __name((...args) => {
|
|
146
146
|
inner(...args);
|
|
147
147
|
return inner.result;
|
|
@@ -203,7 +203,7 @@ var LogManager = class {
|
|
|
203
203
|
const buffer = this.buffers[id].splice(0);
|
|
204
204
|
const toRemoved = [];
|
|
205
205
|
Object.values(this.ctx.console.clients).filter((client) => this.listeners[id].has(client.id)).forEach((client) => {
|
|
206
|
-
if (client.pm2?.lastHeartbeat && Date.now() - client.pm2.lastHeartbeat >
|
|
206
|
+
if (client.pm2?.lastHeartbeat && Date.now() - client.pm2.lastHeartbeat > this.pm2.config.listSyncTimeout) {
|
|
207
207
|
toRemoved.push(client.id);
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
@@ -485,11 +485,12 @@ var PM2 = class extends import_koishi.Service {
|
|
|
485
485
|
})).description("PM2 process event notifications.").default([]).hidden(),
|
|
486
486
|
logSyncInterval: import_koishi.Schema.number().description("The interval (in milliseconds) to sync logs from PM2.").default(200),
|
|
487
487
|
listSyncInterval: import_koishi.Schema.number().description("The interval (in milliseconds) to sync process list from PM2.").default(1e3),
|
|
488
|
+
listSyncTimeout: import_koishi.Schema.number().description("The timeout (in milliseconds) acts as heartbeat for clients requesting process list.").default(3e4),
|
|
488
489
|
actionTimeout: import_koishi.Schema.number().description("The timeout (in milliseconds) for PM2 monitor actions.").default(1e4),
|
|
489
490
|
logTailLines: import_koishi.Schema.number().description("The number of log lines to tail when starting log streaming.").default(100)
|
|
490
491
|
});
|
|
491
492
|
})(PM2 || (PM2 = {}));
|
|
492
|
-
var
|
|
493
|
+
var src_default = PM2;
|
|
493
494
|
// Annotate the CommonJS export names for ESM import in node:
|
|
494
495
|
0 && (module.exports = {
|
|
495
496
|
PM2
|