guoziyun пре 9 месеци
родитељ
комит
abbd8c8ee4

+ 0 - 6
oms/dist/src/controllers/messageRecordController.js

@@ -185,7 +185,6 @@ class MessageRecordController {
          */
         this.getOverallStatistics = async (req, res) => {
             try {
-                console.log("getOverallStatistics");
                 const stats = await this.messageRecordService.getOverallStatistics();
                 return res.status(200).json({ success: true, data: stats });
             }
@@ -201,7 +200,6 @@ class MessageRecordController {
          */
         this.getStatisticsByActivity = async (req, res) => {
             try {
-                console.log("getStatisticsByActivity");
                 const stats = await this.messageRecordService.getStatisticsByActivity();
                 return res.status(200).json({ success: true, data: stats });
             }
@@ -217,7 +215,6 @@ class MessageRecordController {
          */
         this.getStatisticsByStrategy = async (req, res) => {
             try {
-                console.log("getStatisticsByStrategy");
                 const stats = await this.messageRecordService.getStatisticsByStrategy();
                 return res.status(200).json({ success: true, data: stats });
             }
@@ -233,7 +230,6 @@ class MessageRecordController {
          */
         this.getStatisticsByTemplate = async (req, res) => {
             try {
-                console.log("getStatisticsByTemplate");
                 const stats = await this.messageRecordService.getStatisticsByTemplate();
                 return res.status(200).json({ success: true, data: stats });
             }
@@ -249,7 +245,6 @@ class MessageRecordController {
          */
         this.getDailySentTrends = async (req, res) => {
             try {
-                console.log("getDailySentTrends");
                 const stats = await this.messageRecordService.getDailySentTrends();
                 return res.status(200).json({ success: true, data: stats });
             }
@@ -265,7 +260,6 @@ class MessageRecordController {
          */
         this.getAverageDeliveryTime = async (req, res) => {
             try {
-                console.log("getAverageDeliveryTime");
                 const stats = await this.messageRecordService.getAverageDeliveryTime();
                 return res.status(200).json({ success: true, data: stats });
             }

+ 0 - 5
oms/dist/src/services/messageRecordService.js

@@ -156,7 +156,6 @@ class MessageRecordService {
                     },
                 },
             ]);
-            console.log(`overall: ${JSON.stringify(result[0])}`);
             return result[0];
         }
         catch (error) {
@@ -256,7 +255,6 @@ class MessageRecordService {
                     $sort: { deliveredRate: -1 },
                 },
             ]);
-            console.log(`by-activity: ${JSON.stringify(results)}`);
             return results;
         }
         catch (error) {
@@ -356,7 +354,6 @@ class MessageRecordService {
                     $sort: { deliveredRate: -1 },
                 },
             ]);
-            console.log(`by-strategy: ${JSON.stringify(results)}`);
             return results;
         }
         catch (error) {
@@ -456,7 +453,6 @@ class MessageRecordService {
                     $sort: { deliveredRate: -1 },
                 },
             ]);
-            console.log(`by-template: ${JSON.stringify(results)}`);
             return results;
         }
         catch (error) {
@@ -558,7 +554,6 @@ class MessageRecordService {
                     $sort: { date: 1 },
                 },
             ]);
-            console.log(`daily-trends: ${JSON.stringify(results)}`);
             return results;
         }
         catch (error) {

+ 5 - 0
oms/ecosystem.config.js

@@ -5,6 +5,7 @@ module.exports = {
       name: "oms", // PM2 进程名称
       script: "dist/src/app.js", // 编译后的主应用文件
       instances: 1, // 通常为 1,除非您需要多个 Node.js 实例
+      exec_mode: "fork",
       autorestart: true, // 崩溃后自动重启
       watch: false, // 生产环境不监听文件变化
       // max_memory_restart: "1G", // 内存使用超过 1GB 时重启
@@ -72,6 +73,7 @@ module.exports = {
       name: "log-service", // 日志服务进程
       script: "dist/services/log-service.js", // 指向编译后的日志服务文件
       instances: 1, // 通常只需要一个日志写入进程,但也可以是多个并行写入到不同文件或同一文件
+      exec_mode: "fork",
       watch: false,
       max_memory_restart: "500M", // 根据日志量调整内存限制
       env_development: {
@@ -91,6 +93,7 @@ module.exports = {
       name: "ingestor-service", // 数据摄取器进程
       script: "dist/services/ingestor-service.js", // 指向编译后的摄取器服务文件
       instances: 1, // 可以根据处理能力调整实例数量
+      exec_mode: "fork",
       watch: false,
       max_memory_restart: "1G", // 根据数据量和处理逻辑调整内存限制
       env_production: {
@@ -109,6 +112,7 @@ module.exports = {
       name: "cron-jobs", // 定时任务进程
       script: "dist/services/cron-jobs/index.js", // 指向编译后的摄取器服务文件
       instances: 1, // 可以根据处理能力调整实例数量
+      exec_mode: "fork",
       watch: false,
       max_memory_restart: "500M", // 根据数据量和处理逻辑调整内存限制
       env_production: {
@@ -129,6 +133,7 @@ module.exports = {
       script: "dist/services/message-worker.js",
       instances: 1,
       exec_mode: "fork",
+      exec_mode: "fork",
       autorestart: true,
       watch: false,
       env_production: {

+ 0 - 6
oms/src/controllers/messageRecordController.ts

@@ -202,7 +202,6 @@ class MessageRecordController {
    */
   public getOverallStatistics = async (req: Request, res: Response): Promise<Response> => {
     try {
-      console.log("getOverallStatistics");
       const stats = await this.messageRecordService.getOverallStatistics();
       return res.status(200).json({ success: true, data: stats });
     } catch (error: any) {
@@ -218,7 +217,6 @@ class MessageRecordController {
    */
   public getStatisticsByActivity = async (req: Request, res: Response): Promise<Response> => {
     try {
-      console.log("getStatisticsByActivity");
       const stats = await this.messageRecordService.getStatisticsByActivity();
       return res.status(200).json({ success: true, data: stats });
     } catch (error: any) {
@@ -234,7 +232,6 @@ class MessageRecordController {
    */
   public getStatisticsByStrategy = async (req: Request, res: Response): Promise<Response> => {
     try {
-      console.log("getStatisticsByStrategy");
       const stats = await this.messageRecordService.getStatisticsByStrategy();
       return res.status(200).json({ success: true, data: stats });
     } catch (error: any) {
@@ -250,7 +247,6 @@ class MessageRecordController {
    */
   public getStatisticsByTemplate = async (req: Request, res: Response): Promise<Response> => {
     try {
-      console.log("getStatisticsByTemplate");
       const stats = await this.messageRecordService.getStatisticsByTemplate();
       return res.status(200).json({ success: true, data: stats });
     } catch (error: any) {
@@ -266,7 +262,6 @@ class MessageRecordController {
    */
   public getDailySentTrends = async (req: Request, res: Response): Promise<Response> => {
     try {
-      console.log("getDailySentTrends");
       const stats = await this.messageRecordService.getDailySentTrends();
       return res.status(200).json({ success: true, data: stats });
     } catch (error: any) {
@@ -282,7 +277,6 @@ class MessageRecordController {
    */
   public getAverageDeliveryTime = async (req: Request, res: Response): Promise<Response> => {
     try {
-      console.log("getAverageDeliveryTime");
       const stats = await this.messageRecordService.getAverageDeliveryTime();
       return res.status(200).json({ success: true, data: stats });
     } catch (error: any) {

+ 0 - 5
oms/src/services/messageRecordService.ts

@@ -172,7 +172,6 @@ export class MessageRecordService {
         },
       ]);
 
-      console.log(`overall: ${JSON.stringify(result[0])}`);
       return result[0];
     } catch (error) {
       console.error("Error fetching overall statistics:", error);
@@ -273,7 +272,6 @@ export class MessageRecordService {
         },
       ]);
 
-      console.log(`by-activity: ${JSON.stringify(results)}`);
       return results;
     } catch (error) {
       console.error("Error fetching statistics by activity:", error);
@@ -373,7 +371,6 @@ export class MessageRecordService {
           $sort: { deliveredRate: -1 },
         },
       ]);
-      console.log(`by-strategy: ${JSON.stringify(results)}`);
       return results;
     } catch (error) {
       console.error("Error fetching statistics by strategy:", error);
@@ -473,7 +470,6 @@ export class MessageRecordService {
           $sort: { deliveredRate: -1 },
         },
       ]);
-      console.log(`by-template: ${JSON.stringify(results)}`);
       return results;
     } catch (error) {
       console.error("Error fetching statistics by template:", error);
@@ -575,7 +571,6 @@ export class MessageRecordService {
           $sort: { date: 1 },
         },
       ]);
-      console.log(`daily-trends: ${JSON.stringify(results)}`);
       return results;
     } catch (error) {
       console.error("Error fetching daily sent trends:", error);