This PR addresses a bug with the LeakyBucket semaphore and request queue used by the LeakyBucketExecutionPolicy. Check #1055 for more details, but to summarize, if the cancellation token is canceled and an OperationCanceledException or TaskCanceledException is thrown while awaiting the semaphore, the request will not be dequeued.
If the semaphore is sufficiently swamped (e.g. by a webhook endpoint or just very active usage), then the wait time between requests will increase continuously until each request is waiting potentially 5, 10, 15 minutes between when it enters the queue and when it actually sends. This can lead to OOM exceptions as requests pile up and eventually crash the application, further compounding the problem if this is a webhook endpoint.
This PR addresses a bug with the
LeakyBucket
semaphore and request queue used by theLeakyBucketExecutionPolicy
. Check #1055 for more details, but to summarize, if the cancellation token is canceled and anOperationCanceledException
orTaskCanceledException
is thrown while awaiting the semaphore, the request will not be dequeued.If the semaphore is sufficiently swamped (e.g. by a webhook endpoint or just very active usage), then the wait time between requests will increase continuously until each request is waiting potentially 5, 10, 15 minutes between when it enters the queue and when it actually sends. This can lead to OOM exceptions as requests pile up and eventually crash the application, further compounding the problem if this is a webhook endpoint.