discord-php / DiscordPHP

An API to interact with the popular messaging app Discord
MIT License
985 stars 236 forks source link

Problem with retrieveBans #1061

Closed xWildFire closed 1 year ago

xWildFire commented 1 year ago

Environment

Describe the bug

On every start of my app i get this log:

[27.02.2023, 11:19:13] [WARNING] REQ GET guilds/877458187782090782/bans failed: Request timed out after 2 seconds 
[27.02.2023, 11:19:13] [WARNING] REQ GET guilds/883093607609937992/bans failed: Request timed out after 2 seconds 
[27.02.2023, 11:19:13] [WARNING] REQ GET guilds/887785396208029716/bans failed: Request timed out after 2 seconds 
[27.02.2023, 11:19:13] [WARNING] REQ GET guilds/924590592271450142/bans failed: Request timed out after 2 seconds

I have admin permissions on that guilds, its working for 31 guilds except that 5. Always the same guilds on every run. When i use $guild->bans->freshen() its working fine so idk whats wrong with it

full log: err.log

To Reproduce

Built in dphp lib function to retrieveBans on start up

Expected behavior

clear logs

SQKo commented 1 year ago

Can you confirm if those guild ids available? Also do you know how many bans are there?

And if $guild->bans->freshen() works fine, then it's probably just network issue. I noticed in your log it is also loading all members, so the bot start is overloaded with too many requests causing timeouts.

Note using $guild->bans->freshen() without pagination parameters defaults to only load 1000 bans and in such case much lighter than what retrieveBans do.

xWildFire commented 1 year ago

Yes those guild ids are available, saw that now the guild ids are random from all. And ban count it's like 1, 5, 10 etc. I've changed timeout to 3 seconds and the errors are gone, soo something about network when too many requests. I think we can close. Btw hmm can we implement something like request retry when error like "Request timed out after X seconds" appears anywhere?