瀏覽代碼

Fixed checkStationSkip task.

KrisVos130 7 年之前
父節點
當前提交
76fe1695dc
共有 2 個文件被更改,包括 4 次插入5 次删除
  1. 2 4
      backend/logic/stations.js
  2. 2 1
      backend/logic/tasks.js

+ 2 - 4
backend/logic/stations.js

@@ -103,11 +103,9 @@ module.exports = {
 			},
 			(station, next) => {
 				if (!station) return next('Station not found.');
+				notifications.unschedule(`stations.nextSong?id=${station._id}`);
 				notifications.subscribe(`stations.nextSong?id=${station._id}`, _this.skipStation(station._id), true, station);
-				if (station.paused) {
-					notifications.unschedule(`stations.nextSong?id=${station._id}`);
-					return next(true, station);
-				}
+				if (station.paused) return next(true, station);
 				next(null, station);
 			},
 			(station, next) => {

+ 2 - 1
backend/logic/tasks.js

@@ -3,6 +3,7 @@
 const cache = require("./cache");
 const logger = require("./logger");
 const Stations = require("./stations");
+const notifications = require("./notifications");
 const async = require("async");
 let utils;
 let tasks = {};
@@ -29,7 +30,7 @@ let checkStationSkipTask = (callback) => {
 				if (timeElapsed <= station.currentSong.duration) return next2();
 				else {
 					logger.error("TASK_STATIONS_SKIP_CHECK", `Skipping ${station._id} as it should have skipped already.`);
-					Stations.skipStation(station._id);
+					Stations.initializeStation(station._id);
 					next2();
 				}
 			}, () => {