-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
I've been wondering... Why not allow receive some configurations on initialize method?
Today:
def with_ratelimit(&block)
ratelimit = Ratelimit.new("whatsapp", { bucket_interval: BUCKET_INTERVAL })
ratelimit.exec_within_threshold('send_message', threshold: THRESHOLD, interval: INTERVAL) do
ratelimit.add('send_message')
yield
end
end
Desire:
def with_ratelimit(&block)
opts = { bucket_interval: BUCKET_INTERVAL, threshold: THRESHOLD, interval: INTERVAL}
Ratelimit.new("whatsapp::send_message", opts).exec_within_threshold do
# doesnt need to use add method anymore
yield
end
end
I can implement this modification if you agree, what do you think?
Metadata
Metadata
Assignees
Labels
No labels