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

[Bug] fix JDA hangs ~10 min on server stop #129

Merged
merged 3 commits into from Apr 6, 2023

Conversation

Clem-Fern
Copy link
Contributor

@Clem-Fern Clem-Fern commented Apr 3, 2023

Checks

Description

Hi @Xujiayao, hope you're doing well.

Because of the activation of the udpateTopic feature and in some case, the JVM is kept running several minutes after the server has stopped. There's absolutely no log from the mod when the problem occurs.

It seems to be cause by the high rate limit on the discord endpoint api used to update a channel's topic and the fact that MCDC wait for the update to be complete before shutting down the JDA instance. (after quick research, same problem encountered on some other discord integration mod/plugin)

In this fix, the topic update is queued and the mod does not wait anymore for the completion of the future. I also explicitly terminated the HTTPClient instance used by JDA to be sure that, in any case, it will not kept the JVM running after the shutdown. (JDA Doc)

I think there's not over way to avoid this issue due to the discord endpoint rate limit. We could probably add a new config key to let the user free to decide if he wants the server to wait the topic update before shutting down or not.

I hope i didn't miss anything... Feel free to ask if any change need :)

@Xujiayao
Copy link
Owner

Xujiayao commented Apr 5, 2023

It seems to be cause by the high rate limit on the discord endpoint api used to update a channel's topic and the fact that MCDC wait for the update to be complete before shutting down the JDA instance.

This is intentional. MCDC waits until the channel topic is updated to "Server offline", otherwise the channel topic keep showing that the server is online, which is unsatisfactory.

@Clem-Fern
Copy link
Contributor Author

well yeah, that's what i thought. Hence my proposition to add a new configuration to volontary ignore the discord rate limit on the topic's update. That would be a good compromise to avoid this issue without having to totaly disabling the topic feature.

@Xujiayao Xujiayao added the bug Something isn't working label Apr 6, 2023
@Xujiayao Xujiayao merged commit e327647 into Xujiayao:master Apr 6, 2023
@Xujiayao
Copy link
Owner

Xujiayao commented Apr 6, 2023

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants