Bläddra i källkod

refactor: Use capital casing for redis connection commands

Owen Diffey 2 år sedan
förälder
incheckning
7e173da425
2 ändrade filer med 8 tillägg och 8 borttagningar
  1. 5 5
      backend/logic/cache/index.js
  2. 3 3
      backend/logic/notifications.js

+ 5 - 5
backend/logic/cache/index.js

@@ -130,7 +130,7 @@ class _CacheModule extends CoreClass {
 			if (["object", "array"].includes(typeof value)) value = JSON.stringify(value);
 
 			CacheModule.client
-				.hSet(payload.table, key, value)
+				.HSET(payload.table, key, value)
 				.then(() => resolve(JSON.parse(value)))
 				.catch(err => reject(new Error(err)));
 		});
@@ -160,7 +160,7 @@ class _CacheModule extends CoreClass {
 			if (mongoose.Types.ObjectId.isValid(key)) key = key.toString();
 
 			CacheModule.client
-				.hGet(payload.table, key, payload.value)
+				.HGET(payload.table, key, payload.value)
 				.then(value => {
 					let parsedValue;
 					try {
@@ -199,7 +199,7 @@ class _CacheModule extends CoreClass {
 			if (mongoose.Types.ObjectId.isValid(key)) key = key.toString();
 
 			CacheModule.client
-				.hDel(payload.table, key)
+				.HDEL(payload.table, key)
 				.then(() => resolve())
 				.catch(err => reject(new Error(err)));
 		});
@@ -221,7 +221,7 @@ class _CacheModule extends CoreClass {
 			}
 
 			CacheModule.client
-				.hGetAll(payload.table)
+				.HGETALL(payload.table)
 				.then(obj => {
 					if (obj)
 						Object.keys(obj).forEach(key => {
@@ -253,7 +253,7 @@ class _CacheModule extends CoreClass {
 			if (mongoose.Types.ObjectId.isValid(key)) key = key.toString();
 
 			CacheModule.client
-				.del(key)
+				.DEL(key)
 				.then(() => resolve())
 				.catch(err => reject(new Error(err)));
 		});

+ 3 - 3
backend/logic/notifications.js

@@ -113,7 +113,7 @@ class _NotificationsModule extends CoreClass {
 				else if (this.getStatus() === "LOCKDOWN" || this.getStatus() === "RECONNECTING")
 					this.setStatus("READY");
 
-				this.sub.pSubscribe(`__keyevent@${this.pub.options.db}__:expired`, (message, channel) => {
+				this.sub.PSUBSCRIBE(`__keyevent@${this.pub.options.db}__:expired`, (message, channel) => {
 					this.log("STATION_ISSUE", `PMESSAGE1 - Channel: ${channel}; ExpiredKey: ${message}`);
 
 					this.subscriptions.forEach(sub => {
@@ -167,7 +167,7 @@ class _NotificationsModule extends CoreClass {
 						.digest("hex")}; StationId: ${payload.station._id}; StationName: ${payload.station.name}`
 				);
 				NotificationsModule.pub
-					.set(
+					.SET(
 						crypto.createHash("md5").update(`_notification:${payload.name}_`).digest("hex"),
 						"",
 						"PX",
@@ -260,7 +260,7 @@ class _NotificationsModule extends CoreClass {
 					.digest("hex")}`
 			);
 			NotificationsModule.pub
-				.del(crypto.createHash("md5").update(`_notification:${payload.name}_`).digest("hex"))
+				.DEL(crypto.createHash("md5").update(`_notification:${payload.name}_`).digest("hex"))
 				.then(() => resolve())
 				.catch(err => reject(new Error(err)));
 		});