Modified Queue Logic to handle bulk queueing better.

This commit is contained in:
rainbow napkin 2025-04-10 20:33:36 -04:00
parent b27175bb7d
commit 3c144894c6

View file

@ -53,6 +53,7 @@ module.exports = class{
}
defineListeners(socket){
//Queueing Functions
socket.on("queue", (data) => {this.queueURL(socket, data)});
socket.on("stop", (data) => {this.stopMedia(socket)}); //needs perms
socket.on("delete", (data) => {this.deleteMedia(socket, data)});
@ -279,8 +280,6 @@ module.exports = class{
//Grab the next item
const nextItem = this.getNextItem();
//If we have no next item
if(nextItem == null){
//Get current item
const currentItem = this.getItemAtEpoch()
@ -289,8 +288,9 @@ module.exports = class{
//Start the found item at w/ a pre-calculated time stamp to reflect the given start time
this.start(currentItem, Math.round((new Date().getTime() - currentItem.startTime) / 1000) + currentItem.startTimeStamp, volatile);
}
//otherwise if we have an item
}else{
//If we have a next item
if(nextItem != null){
//Calculate the amount of time in ms that the next item will start in
const startsIn = nextItem.startTime - new Date().getTime();