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 CHANGED
@@ -80,6 +80,7 @@ export declare namespace PM2 {
80
80
  alerts: Alert[];
81
81
  logSyncInterval: number;
82
82
  listSyncInterval: number;
83
+ listSyncTimeout: number;
83
84
  actionTimeout: number;
84
85
  logTailLines: number;
85
86
  }
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 index_exports = {};
32
- __export(index_exports, {
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
33
  PM2: () => PM2,
34
- default: () => index_default
34
+ default: () => src_default
35
35
  });
36
- module.exports = __toCommonJS(index_exports);
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(((...args) => {
142
+ const inner = ctx.throttle((...args) => {
143
143
  inner.result = callback(...args);
144
- }), delay, noTrailing);
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 > 3e4) {
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 index_default = PM2;
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
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-pm2",
3
3
  "description": "PM2 process manager dashboard",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [