Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate limit on fetching Tetra Channel information for players in room #57

Open
mat1jaczyyy opened this issue Mar 29, 2024 · 9 comments
Open

Comments

@mat1jaczyyy
Copy link
Contributor

if a room has 10+ people it's possible to hit rate limit on channelApi here, which takes down the entire node process:

data.players.map(async ({ _id, bracket }: any) => {
return [_id, { user: await client.fetchUser(_id), bracket }];
})

/srv/eucannon-prod/bot/node_modules/tetr.js/dist/util/channelApi.js:34
            throw Error((yield response).error);
                  ^

Error: Rate limit exceeded! | You are doing that far too quickly.
    at /srv/eucannon-prod/bot/node_modules/tetr.js/dist/util/channelApi.js:34:19
    at Generator.next (<anonymous>)
    at fulfilled (/srv/eucannon-prod/bot/node_modules/tetr.js/dist/util/channelApi.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
@mat1jaczyyy mat1jaczyyy changed the title Fetching Tetra Channel information for players in room causes rate limit crash Rate limit on fetching Tetra Channel information for players in room Mar 29, 2024
@mat1jaczyyy
Copy link
Contributor Author

do you expect the newly implemented err/kick/nope handling to handle this case, allowing us to log the error and only taking down that client instead of the entire process?

@Sup3rFire
Copy link
Member

the newly implemented err/kick/nope only emits the respective events that are sent from the server

@mat1jaczyyy
Copy link
Contributor Author

the newly implemented err/kick/nope only emits the respective events that are sent from the server

can you pls try catch this somehow and stall for a second or two and try again on exception?

we got a 100 entrant tournament rn and this is looking scary as hell

or maybe allow for caching the channelApi results and only fetching them once ever

@Genius6942
Copy link

Use the game api instead of tetr channel (no rate limit) https://tetr.io/api/users/${userid}

@mat1jaczyyy
Copy link
Contributor Author

big if true, is he right

@Sup3rFire
Copy link
Member

seems like the rate limit is a lot higher there yes

@Sup3rFire
Copy link
Member

ill change this in a later update since using tetrchannel isnt really causing problems for now

@mat1jaczyyy
Copy link
Contributor Author

well it didnt happen last month but it just happened again right now, luckily it's stream room so no big deal but if this were to happen mid tournament we are shitting bricks

2024-06-02 14:12:43.077  [Room KSQR] Replay saved! IDreplay=614 for IDmatch=811
/srv/eucannon-prod/bot/node_modules/tetr.js/dist/util/channelApi.js:35
            throw Error((yield response).error);
                  ^

Error: Rate limit exceeded! | You are doing that far too quickly.
    at /srv/eucannon-prod/bot/node_modules/tetr.js/dist/util/channelApi.js:35:19
    at Generator.next (<anonymous>)
    at fulfilled (/srv/eucannon-prod/bot/node_modules/tetr.js/dist/util/channelApi.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

@Sup3rFire
Copy link
Member

ok nvm ill implement it soon then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants