浏览代码

Server: Initial Service Checks - queue in main thread for thread safety

Christian Kahlau 3 年之前
父节点
当前提交
20fe55fa60
共有 1 个文件被更改,包括 5 次插入7 次删除
  1. 5 7
      server/src/ctrl/http-check-controller.class.ts

+ 5 - 7
server/src/ctrl/http-check-controller.class.ts

@@ -20,17 +20,15 @@ export class HttpCheckController {
         await this.db.open();
         const configs = await this.db.getHttpCheckConfigs();
 
-        configs.forEach(async conf => {
+        for (const conf of configs) {
           if (!conf) return;
           if (!conf.active) return;
 
-          const sub = await this.scheduleCheck(conf);
+          await this.scheduleCheck(conf);
 
-          process.nextTick(async () => {
-            Logger.info('[INFO] Initial HTTP Service Check for', conf.title, '...');
-            await this.timerTick(conf);
-          });
-        });
+          Logger.info('[INFO] Initial HTTP Service Check for', conf.title, '...');
+          await this.timerTick(conf);
+        }
       } catch (err) {
         Logger.error('[FATAL] Initializing ServerConnector failed:', err);
         Logger.error('[EXITING]');