shipgirlproject / Shoukaku

A stable, powerful and updated wrapper around Lavalink
https://guide.shoukaku.shipgirl.moe/
MIT License
268 stars 82 forks source link

feature: refresh player data from lavalink and use a caching system #182

Closed KagChi closed 1 month ago

0t4u commented 1 month ago

Do you want to refresh the player data from the lavalink instance or what do you want it to achieve?

Deivu commented 1 month ago

If im not mistaken, there is already functions for that.

<Node>.rest.getPlayer(id) // (Lavalink player data)
<Shoukaku>.players.get(id) // (Shoukaku player data)
KagChi commented 1 month ago

i think that would be better with djs cache manager implementation ig, if you familiar with it tho

0t4u commented 1 month ago

Why would that be beneficial? That would add some level of complexity.

EvilG-MC commented 1 month ago

I don't recommend use the djs cache

KagChi commented 1 month ago

Why would that be beneficial? That would add some level of complexity.

naaah, i mean add fetch func to force fetch or get it from the cache just like djs cache manager

KagChi commented 1 month ago

I don't recommend use the djs cache

who said use djs cache? i just said take the reference from djs cache manager, fetch one

0t4u commented 1 month ago

Correct me if I am wrong, but since Shoukaku does not "garbage collect" (remove instances of) players, and also already has the Node#rest.getPlayer() function to get raw data from Lavalink, there isn't really a point in fetching the data again since it would just be identical to the cached data anyways. Since a Player is created when you join a voice channel and gets destroyed after disconnecting from the voice channel, all active Players are being actively handled by Shoukaku anyways, unless something goes really wrong and Shoukaku is completely out of sync from Lavalink.

0t4u commented 1 month ago

@KagChi @EvilG-MC

EvilG-MC commented 1 month ago

@KagChi @EvilG-MC

I really agree with your point, because after giving it a lot of thought, a fetch is really a bit unnecessary. I think its only purpose (which I really don't think is the case) is in case the data for some specific reason is out of date.

EvilG-MC commented 1 month ago

For my part I could say that I'm fine with what is currently available.

0t4u commented 1 month ago

I'm going to see if I can get into contact/get Saya to get into contact with some bot developers who use Shoukaku in production at scale to see if they have a use case for this, if they don't then @KagChi is welcome to implement it and open a PR