PerformanC / NodeLink

Performant LavaLink alternative written with Node.Js
BSD 2-Clause "Simplified" License
38 stars 23 forks source link

[BUG]: Player count goes below zero #48

Closed Joniii11 closed 4 months ago

Joniii11 commented 4 months ago

NodeLink version

2.0.1 (ce2d11259bd2c83dbac0a8875e54a32b4dbe62e4)

Description

So basically the playing players number go below zero. image

Client

Modified Poru V4.2

Steps to reproduce

Fetch the status and return the playing player count.

Example code

Just fetch the status

Confirmations

Code of Conduct

UnschooledGamer commented 4 months ago

Fetch the status or stats as its only an valid endpoint.

ThePedroo commented 4 months ago

I tried to reproduce this in any way possible, however I wasn't able to get playingPlayers value from /v4/stats below zero

1Lucas1apk commented 4 months ago

Are you using the latest version?

UnschooledGamer commented 4 months ago

Are you using the latest version?

As it mentioned in the issue body. They are using latest version (latest commit too)

UnschooledGamer commented 4 months ago

Except for the commit pushed by Pedro 2hrs back.

Joniii11 commented 4 months ago
        const totalPlayingPlayersString: string[] = [];
        let totalPlayingPlayers = 0;

        client.poru.nodes.forEach(async (node) => {
            const stats = node.stats ? node.stats.playingPlayers : (await node.rest.get<NodeStats>(`/v4/stats`)).playingPlayers;
            totalPlayingPlayers += stats;
            totalPlayingPlayersString.push(`\nPlayers:  ${stats}`);
        });

I am using that to get the stats tho, so it is most likely a issue with NodeLink