@lih-x-x/kmr 1.0.22 → 1.0.23

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1385,5 +1385,22 @@ async function main() {
1385
1385
  }
1386
1386
  syncTaskStatuses();
1387
1387
  setInterval(syncTaskStatuses, 60 * 60 * 1e3);
1388
+ if (config.lark.adminOpenId) {
1389
+ const adminId = config.lark.adminOpenId;
1390
+ let exiting = false;
1391
+ const onExit = async (signal) => {
1392
+ if (exiting) return;
1393
+ exiting = true;
1394
+ console.log(`[exit] \u6536\u5230 ${signal}\uFF0C\u6B63\u5728\u9000\u51FA...`);
1395
+ try {
1396
+ await messenger.sendToUser(adminId, `\u26D4 KMR \u670D\u52A1\u5DF2\u505C\u6B62\uFF08${signal}\uFF09`);
1397
+ } catch (err) {
1398
+ console.error("[notify] \u63A8\u9001\u505C\u6B62\u901A\u77E5\u5931\u8D25:", err.message);
1399
+ }
1400
+ process.exit(0);
1401
+ };
1402
+ process.on("SIGINT", () => onExit("SIGINT"));
1403
+ process.on("SIGTERM", () => onExit("SIGTERM"));
1404
+ }
1388
1405
  }
1389
1406
  main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lih-x-x/kmr",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {