Fixed queue rendering issue by changing server-side behavior around queue broadcasting.

This commit is contained in:
rainbow napkin 2025-10-28 06:33:52 -04:00
parent dd66601f0d
commit a1f0824330

View file

@ -1078,6 +1078,7 @@ class queue{
if(this.nowPlaying != null){ if(this.nowPlaying != null){
//Silently end the media in RAM so the database isn't stepping on itself up ahead //Silently end the media in RAM so the database isn't stepping on itself up ahead
//Alternatively we could've used await, but then we'd be doubling up on DB transactions :P //Alternatively we could've used await, but then we'd be doubling up on DB transactions :P
//VOLATILE END
this.end(true, true, true); this.end(true, true, true);
} }
@ -1116,6 +1117,9 @@ class queue{
//Save the channel //Save the channel
await chanDB.save(); await chanDB.save();
//Broadcast queue since we ended our media item early
this.broadcastQueue(chanDB);
}catch(err){ }catch(err){
loggerUtils.localExceptionHandler(err); loggerUtils.localExceptionHandler(err);
} }
@ -1171,7 +1175,7 @@ class queue{
* End currently playing media * End currently playing media
* @param {Boolean} quiet - Enable to prevent ending the media client-side * @param {Boolean} quiet - Enable to prevent ending the media client-side
* @param {Boolean} noArchive - Enable to prevent ended media from being written to channel archive. Deletes media if Volatile is false * @param {Boolean} noArchive - Enable to prevent ended media from being written to channel archive. Deletes media if Volatile is false
* @param {Boolean} volatile - Enable to prevent DB Transactions * @param {Boolean} volatile - Enable to prevent DB Transactions, also prevents queue broadcasting so the calling code can broadcast once it's done.
* @param {Mongoose.Document} chanDB - Pass through Channel Document to save on DB Transactions * @param {Mongoose.Document} chanDB - Pass through Channel Document to save on DB Transactions
*/ */
async end(quiet = false, noArchive = false, volatile = false, chanDB){ async end(quiet = false, noArchive = false, volatile = false, chanDB){
@ -1247,9 +1251,6 @@ class queue{
//Save our changes to the DB //Save our changes to the DB
await chanDB.save(); await chanDB.save();
}else{
//broadcast queue using unsaved archive
this.broadcastQueue(chanDB);
} }
}catch(err){ }catch(err){
this.broadcastQueue(); this.broadcastQueue();