Kaynağa Gözat

Fixed some issues with tasks and cache

Kristian Vos 4 yıl önce
ebeveyn
işleme
2b9286650a
2 değiştirilmiş dosya ile 5 ekleme ve 3 silme
  1. 2 0
      backend/logic/cache/index.js
  2. 3 3
      backend/logic/tasks.js

+ 2 - 0
backend/logic/cache/index.js

@@ -270,6 +270,8 @@ class _CacheModule extends CoreClass {
 						} catch (err) {
 							console.error(err);
 						}
+					else if (message.startsWith('"') && message.endsWith('"'))
+						message = message.substring(1).substring(0, message.length - 2);
 
 					return subs[channel].cbs.forEach(cb => cb(message));
 				});

+ 3 - 3
backend/logic/tasks.js

@@ -140,7 +140,7 @@ class _TasksModule extends CoreClass {
 			const task = TasksModule.tasks[payload.name];
 			if (task.timer) task.timer.pause();
 
-			task.fn.apply(null).then(() => {
+			task.fn.apply(this).then(() => {
 				task.lastRan = Date.now();
 				task.timer = new Timer(
 					() => TasksModule.runJob("RUN_TASK", { name: payload.name }),
@@ -432,7 +432,7 @@ class _TasksModule extends CoreClass {
 					stationsCountUpdated.forEach(stationId => {
 						this.log("INFO", "UPDATE_STATION_USER_COUNT", `Updating user count of ${stationId}.`);
 						CacheModule.runJob("PUB", {
-							table: "station.updateUserCount",
+							channel: "station.updateUserCount",
 							value: stationId
 						});
 					});
@@ -440,7 +440,7 @@ class _TasksModule extends CoreClass {
 					stationsUpdated.forEach(stationId => {
 						this.log("INFO", "UPDATE_STATION_USER_LIST", `Updating user list of ${stationId}.`);
 						CacheModule.runJob("PUB", {
-							table: "station.updateUsers",
+							channel: "station.updateUsers",
 							value: stationId
 						});
 					});