Kaynağa Gözat

Fixed more issues with socket not removing callbacks and backend being spammed.

KrisVos130 8 yıl önce
ebeveyn
işleme
dd6322a8b4

+ 1 - 0
backend/logic/actions/playlists.js

@@ -101,6 +101,7 @@ let lib = {
 			(next) => {
 				const { name, displayName, songs } = data;
 				db.models.playlist.create({
+					_id: utils.generateRandomString(17),//TODO Check if exists
 					displayName,
 					songs,
 					createdBy: userId,

+ 1 - 0
backend/logic/db/schemas/playlist.js

@@ -1,4 +1,5 @@
 module.exports = {
+	_id: { type: String, min: 17, max: 17, unique: true, index: true, required: true },
 	displayName: { type: String, min: 2, max: 32, required: true },
 	songs: { type: Array },
 	createdBy: { type: String, required: true },

+ 1 - 1
frontend/io.js

@@ -27,7 +27,7 @@ export default {
 
 	removeAllListeners: function () {
 		Object.keys(this.socket._callbacks).forEach((id) => {
-			if (id.indexOf("$event:song") !== -1) {
+			if (id.indexOf("$event:") !== -1) {
 				delete this.socket._callbacks[id];
 			}
 		});