discord-jda / JDA

Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Apache License 2.0
4.34k stars 735 forks source link

RateLimiter never shuts down if there is a empty and non-empty bucket at shutdown #2079

Closed Vankka closed 2 years ago

Vankka commented 2 years ago

General Troubleshooting

Bug Report

If at JDA's shutdown there is a rate limit bucket with 1 request or more and one with 0 requests, the rate limiter will never shut down.

Relevant code, backoff won't be called for a empty bucket, so it won't get removed, and the requester won't get shutdown if there is a bucket.

Clearing buckets with 0 requests at #stop should solve this

Expected Behavior

The rate limiter should shut down

Code Example or Reproduction Steps

Reproduction steps

Demo application

Code for JDABuilder or DefaultShardManagerBuilder Used

n/a

Exception or Error

n/a

MinnDevelopment commented 2 years ago

Fixed in 5.0.0-alpha.10