FAForever / faf-qai

QAI reloaded
MIT License
2 stars 1 forks source link

Long running commands cause Discord MESSAGE_CREATED event timeouts #12

Open Soyvolon opened 3 years ago

Soyvolon commented 3 years ago
info: System.Net.Http.HttpClient.ApiClient.ClientHandler[100]
      Sending HTTP request GET https://api.faforever.com/data/game?include=mapVersion,playerStats,mapVersion.map,playerStats.player,featuredMod,playerStats.player.globalRating,playerStats.player.ladder1v1Rating,playerStats.player.clanMembership.clan&filter=playerStats.player.login==Soyvolon
[2021-01-20 18:01:50 -05:00] [104 /EventHandler] [Error] Event handler exception for event MESSAGE_CREATED thrown from System.Threading.Tasks.Task QMmands_MessageCreated(DSharpPlus.DiscordClient, DSharpPlus.EventArgs.MessageCreateEventArgs) (defined in Faforever.Qai.Discord.DiscordBot)
Emzi0767.Utilities.AsyncEventTimeoutException`2[DSharpPlus.DiscordClient,DSharpPlus.EventArgs.MessageCreateEventArgs]: An event handler caused the invocation of an asynchronous event to time out.
[2021-01-20 18:01:50 -05:00] [104 /EventHandler] [Error] Event handler exception for event MESSAGE_CREATED thrown from System.Threading.Tasks.Task Client_MessageCreated(DSharpPlus.DiscordClient, DSharpPlus.EventArgs.MessageCreateEventArgs) (defined in DSharpPlus.DiscordShardedClient)
Emzi0767.Utilities.AsyncEventTimeoutException`2[DSharpPlus.DiscordClient,DSharpPlus.EventArgs.MessageCreateEventArgs]: An event handler caused the invocation of an asynchronous event to time out.

Command still executes properly, but the command handler errors.

This is caused by long running command pausing the event handlers, when the commands should be running elsewhere. Code needs to be refactored for the Discord MESSAGE_CREATED event handling

chrsin commented 3 years ago

Is this still an issue? Cause I fixed an issue with the clan parsing

Soyvolon commented 3 years ago

No it is still a problem, but that's mainly because the commands are for some reason holding up the event handler. Which means I need to go refactor that to prevent timeouts on long running commands.