From a75914b0a67ff49cd77a6d007d5baaa52e27b09d Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Fri, 9 Jun 2023 21:33:47 +0200 Subject: [PATCH] Update comment for initial call value --- lib/nostrum/api/ratelimiter.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/nostrum/api/ratelimiter.ex b/lib/nostrum/api/ratelimiter.ex index 8b83345ac..8f2954367 100644 --- a/lib/nostrum/api/ratelimiter.ex +++ b/lib/nostrum/api/ratelimiter.ex @@ -368,10 +368,10 @@ defmodule Nostrum.Api.Ratelimiter do # There is no entry. We are the pioneer for this bucket. nil -> # Since we don't have any explicit ratelimiting information for this - # bucket yet, we set the remaining calls to zero. While the first - # request is in flight, we do not want any further requests to be sent - # out until we have ratelimit information from it, at which point other - # requests are ran from the queue. + # bucket yet, we set the remaining calls to the special `:initial` + # value. The ratelimit response header parser uses this value to know + # when it should update ratelimit information from upstream, and new + # incoming requests will be held off appropriately. run_request = {:next_event, :internal, {:run, request, bucket, from}} data_with_new_queue = put_in(data, [:outstanding, bucket], {:initial, :queue.new()}) {:keep_state, data_with_new_queue, [run_request]}