I’m writing a script using the MessagingService and I cannot figure out how to rate limit my requests.
Basically I’m trying to figure out when MessagingService limits are reset.
I’d assume they reset similar to one of the following:
PublishAsync()
> requests++
> wait(60)
> requests--
PublishAsync()
> requests++
AND while true
> wait(60)
> requests = 0
I’m not sure which determines how limits are reset and thus I am not sure how to keep track of my budget and prevent myself from going over the limit/slow down requests.
My goal is to have a main loop which sends requests and then a few functions which will fire requests based on live occurences. If the functions are called too frequently I’d like to slow down my loop/slow down requests and if the limit is hit I’d like to wait for request space so I won’t lose requests.