You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a LimitedCollection with maxSize of 2 and a keepOverLimit function
Add 2 elements that pass keepOverLimit
Add one that doesn't
Check to see that all 3 elements were correctly inserted
Add a fourth element that doesn't pass keepOverLimit
Check to see that the first element you added that didn't pass keepOverLimit has now been removed in order for your new element to be inserted, leaving you with 3 elements instead of 4.
The way I interpret this keepOverLimit function is that "any element added that passes this condition isn't counted towards the total size limit". I understand there may be other interpretations to this and that the current implementation may be right in the eyes of who interpreted this criteria, but I think this is also a valid way of seeing it and I would like to know if it is possible to change the current implementation to support this.
Code sample
No response
Versions
discord.js v14.14.1
Node.js v20.10.0
Issue priority
Low (slightly annoying)
Which partials do you have configured?
Not applicable
Which gateway intents are you subscribing to?
Not applicable
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered:
ImRodry
changed the title
LimitedCollection's maxSize also contemplates items that pass keepOverLimit
LimitedCollection's maxSize also counts items that pass keepOverLimit
Dec 29, 2023
A function, which is passed the value and key of an entry, ran to decide to keep an entry past the maximum size
That’s what keepOverLimit is documented to be. And that’s what it is. It decides whether to keep an element although it‘s past the maxSize. Nowhere does it say that it doesn’t count towards the maxSize nor was it ever intended to be that way. So I doubt anyone would implement a breaking change into how this property acts without any reason to do so other than you misunderstanding what it‘s supposed to do.
It's exactly because it doesn't say what happens to maxSize that I think it's reasonable to assume it doesn't count, just like it would be reasonable to assume that it does. If you're keeping an element over the limit, why would it count towards that limit and take up the space that could be taken up by other values that don't pass the requirements of that function?
Which package is this bug report for?
discord.js
Issue description
The way I interpret this keepOverLimit function is that "any element added that passes this condition isn't counted towards the total size limit". I understand there may be other interpretations to this and that the current implementation may be right in the eyes of who interpreted this criteria, but I think this is also a valid way of seeing it and I would like to know if it is possible to change the current implementation to support this.
Code sample
No response
Versions
Issue priority
Low (slightly annoying)
Which partials do you have configured?
Not applicable
Which gateway intents are you subscribing to?
Not applicable
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: