Conversation
… constructor - sync(): Used this.tracks.length instead of this.previous.length when splicing the previous array, causing incomplete overrides that corrupt queue state on sync. - constructor: queueOptions parameter is optional but was accessed without optional chaining, causing TypeError when omitted.
…r rate-limiting - error(): reconnect() was called before socket.close(), causing duplicate reconnection attempts. Now reconnect only runs when closeOnError is false; otherwise the close event handles it. - trackStuck()/trackError(): Used > instead of >= in rate-limiting, allowing one extra error beyond the configured maxAmount before destroying the player.
…setSpeed/setPitch/setRate - resetFilters(): Duplicate karaoke reset instead of resetting vaporwave, leaving the vaporwave flag active after a full reset. - setSpeed/setPitch/setRate: Each method replaced the entire timescale object from defaults, discarding prior customizations from the other methods. Now preserves existing timescale state.
- changeNode(): The else branch unconditionally called setSponsorBlock() with default categories when moving to a new node, even if the user never enabled SponsorBlock. Now only re-applies if categories were previously set.
Tomato6966
left a comment
There was a problem hiding this comment.
I have a left a few comments. first up: Thanks for the bug fixes, please implement my requested changes.
| this.filters.tremolo = false; | ||
| this.filters.vibrato = false; | ||
| this.filters.karaoke = false; | ||
| this.filters.karaoke = false; |
|
|
||
| this.filters.nightcore = false; | ||
| this.filters.vaporwave = false; | ||
| this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, speed }; |
There was a problem hiding this comment.
good thing. could you add that it first spreads the deafult data, then the pre-applied data, and then the speed? or just map the 3 vaslues...
|
|
||
| this.filters.nightcore = false; | ||
| this.filters.vaporwave = false; | ||
| this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, pitch }; |
There was a problem hiding this comment.
good thing. could you add that it first spreads the deafult data, then the pre-applied data, and then the speed? or just map the 3 vaslues...
|
|
||
| this.filters.nightcore = false; | ||
| this.filters.vaporwave = false; | ||
| this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, rate }; |
There was a problem hiding this comment.
good thing. could you add that it first spreads the deafult data, then the pre-applied data, and then the speed? or just map the 3 vaslues...
src/structures/Node.ts
Outdated
| if (this.heartBeatInterval) clearInterval(this.heartBeatInterval); | ||
| if (this.pingTimeout) clearTimeout(this.pingTimeout); | ||
| this.socket?.close(500, "Node-Error - Force Reconnect"); | ||
| } else { |
There was a problem hiding this comment.
instead of else, do a return in the if () above.
| ); | ||
| player.set("internal_erroredTracksTimestamps", [...oldTimestamps, Date.now()]); | ||
| if (oldTimestamps.length > this._LManager.options.playerOptions.maxErrorsPerTime?.maxAmount) { | ||
| if (oldTimestamps.length >= this._LManager.options.playerOptions.maxErrorsPerTime?.maxAmount) { |
There was a problem hiding this comment.
Thank you.
since we are comparing old data and not new data >= is correct.
| functionLayer: "Player > changeNode()", | ||
| }); | ||
| }); | ||
| } else { |
There was a problem hiding this comment.
the else branch called setSponsorBlock() with no arguments which applies default sponsor-block categories this means when a player changes nodes even if the user never enabled SponsorBlock they'd suddenly get default filtering enabled silently skipping track segments without opting in by removing the else SponsorBlock is only re-applied on the new node if the user had previously set specific categories via setSponsorBlock(categories)
There was a problem hiding this comment.
@rly-dev the else block was there so that the ChapterStarted and ChapterLoaded event will work from the SponsorBlock plugin on the newNode (I didn't investigate why this was the case that's why I left that there).
There was a problem hiding this comment.
thanks for the context reverted that change in f525b91 — the else block is restored so SponsorBlock events register properly on the new node
There was a problem hiding this comment.
i were correct about the surface-level behavior (it does set defaults) but wrong about the intent (it's a necessary side effect for plugin event registration not an accidental opt-in)
There was a problem hiding this comment.
also i have added comments on line 953-954 in 30a5118
There was a problem hiding this comment.
you can implement an option in the parent function.
There was a problem hiding this comment.
"enforceSponsorBlockRequestForEventEnablement"
There was a problem hiding this comment.
Added enforceSponsorBlockRequestForEventEnablement as a configurable option in ManagerPlayerOptions (commit b404f71)
There was a problem hiding this comment.
if you approve this then i would gladly update in the docs LavalinkManager
| ) | ||
| this.previous.splice( | ||
| 0, | ||
| override ? this.tracks.length : 0, |
|
sure thing i would do it in few mins |
- Filters.ts: spread defaults first, then existing timescale, then new value in setSpeed/setPitch/setRate for guaranteed key coverage. - Node.ts: use early return in closeOnError block instead of if/else.
|
refactor updated the code and committed (4e3d867) |
The else block is intentional - setSponsorBlock() with defaults is needed so the SponsorBlock plugin registers ChapterStarted/ChapterLoaded event listeners on the new node.
Clarifies that setSponsorBlock() with defaults is needed on node change so the SponsorBlock plugin registers ChapterStarted/ChapterLoaded event listeners on the new node.
Adds a configurable option to control whether setSponsorBlock() with defaults is called on node change for SponsorBlock event registration. Defaults to true to preserve existing behavior. Set to false to disable if you don't use SponsorBlock events.
In Queue.ts there are two fixes
sync()uses wrong array length forpreviousQueue.utils.sync()when overriding the previous array with data from the queue store the splice call used isthis.tracks.lengthas the delete count instead ofthis.previous.lengthqueueOptionsin constructorqueueOptionsis typed asqueueOptions?: ManagerQueueOptions(optional) but line 153 accessed it asqueueOptions.queueChangesWatcherwithout optional chainingIn Node.ts there are two fixes
error()handlercloseOnErrorenabled the handler calledthis.reconnect()first then calledthis.socket?.close()theclose()call fires acloseevent on the socket which triggers theclosehandler and that handler also callsreconnect()trackStuck()andtrackError()filter old timestamps push the current timestamp then checkif (oldTimestamps.length > maxAmount)butoldTimestampswas captured before the current error was added to the stored array so it doesn't include the current errorIn Filters.ts two fixes
resetFilters()karaoke resets twice but vaporwave doesnt resetresetFilters()two consecutive lines both setthis.filters.karaoke = falsethe second line was clearly meant to bethis.filters.vaporwave = falsesetSpeed/setPitch/setRateoverwrite each others valuesthis.data.timescaleobject by spreadingDEFAULT_FILTER_DATAS.timescale(which has speed: 1, pitch: 1, rate: 1) and then overriding only their own property for examplesetSpeed(2)produces{ speed: 2, pitch: 1, rate: 1 }In Player.ts one fix
changeNode()enables SponsorBlock on node change defaultchangeNode()when the new node supports SponsorBlock, the code checked ifsponsorBlockCategorieswas a non-empty array if it was it re-applied those categories (correct) but theelsebranch calledsetSponsorBlock()with no arguments which applies default categoriesCommit History and Details
dc406be Fix Queue sync & constructor
56799fe Fix Node reconnect & ratelimit
7d2cdd6 Fix Filters reset & timescale
19ee6aa Fix Player SponsorBlock default