Преглед изворни кода

Added a check to see if notify-keyspace-events is set correctly

Kristian Vos пре 4 година
родитељ
комит
e1a79d627d
1 измењених фајлова са 20 додато и 0 уклоњено
  1. 20 0
      backend/logic/notifications.js

+ 20 - 0
backend/logic/notifications.js

@@ -3,6 +3,7 @@ const CoreClass = require("../core.js");
 const crypto = require("crypto");
 const redis = require("redis");
 const config = require("config");
+const utils = require("./utils");
 
 const subscriptions = [];
 
@@ -93,6 +94,25 @@ class NotificationsModule extends CoreClass {
             this.pub.on("connect", () => {
                 this.log("INFO", "Pub connected succesfully.");
 
+                this.pub.config("GET", "notify-keyspace-events", async (err, response) => {
+                    if (err) {
+                        err = await utils.runJob("GET_ERROR", { error: err });
+                        this.log("ERROR", "NOTIFICATIONS_INITIALIZE", `Getting notify-keyspace-events gave an error. ${err}`);
+                        this.log(
+                            "STATION_ISSUE",
+                            `Getting notify-keyspace-events gave an error. ${err}. ${response}`
+                        );
+                        return;
+                    }
+                    if (response[1] === "xE") {
+                        this.log("INFO", "NOTIFICATIONS_INITIALIZE", `notify-keyspace-events is set correctly`);
+                        this.log("STATION_ISSUE", `notify-keyspace-events is set correctly`);
+                    } else {
+                        this.log("ERROR", "NOTIFICATIONS_INITIALIZE", `notify-keyspace-events is NOT correctly! It is set to: ${response[1]}`);
+                        this.log("STATION_ISSUE", `notify-keyspace-events is NOT correctly! It is set to: ${response[1]}`);
+                    }
+                });
+
                 if (this.getStatus() === "INITIALIZING") resolve();
                 else if (
                     this.getStatus() === "LOCKDOWN" ||