Open Lasvad opened 7 years ago
It will hang for a minimum of 1 bucket_interval if the threshold has been reached. Is it hanging for longer than that?
def exec_within_threshold(subject, options = {}, &block)
options[:threshold] ||= 30
options[:interval] ||= 30
while exceeded?(subject, options)
sleep @bucket_interval
end
yield(self)
end
When testing code that had ratelimit implemented, it will sometimes hang with on this code as it thinks the subject has exceeded its amount. User testing it works fine, anyone else having issues with this?
ratelimit.exec_within_threshold "shopify_api", threshold: 2, interval: 1 do
I am trying to respect shopify's rate limit.