You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't tried it myself, but I am wondering if there is a way to stack throttle definitions. Here is a use case:
We have a portion of a system that receives callbacks about incoming calls from provider A, and hangs up the call, and then schedules a job to start a call from provider B. Provider B has a rate limit of 2 requests per second. However, quite often provider A hits us twice with a callback for the same call, 3-15 seconds apart. So I would like to have 2 throttle guards:
Standard 2 per second limit
Parameter based throttle (i.e don't call the same number twice in a 20 second window)
How could I get this accomplished?
The text was updated successfully, but these errors were encountered:
It isn't documented (the other open issue addresses this 😄 #3), but you can have the throttle key based on a lambda, so you could programmatically generate a throttle key by the phone number.
So, how I would do it would be something like (untested, but should work):
classNumberCallbackJob < ApplicationJobthrottlethreshold: 2,period: 1.secondconcurrency1,drop: true,key: ->(job){job.arguments.first# if the first argument is a phone number e.g. }defperform# do the stuffendend
Oh my goodness, I didn't realize you opened both issues! Sorry if that is a repeat, then; let me know if there's an extension that would help with this (the feature request that might make sense would be multi-key handling).
I haven't tried it myself, but I am wondering if there is a way to stack
throttle
definitions. Here is a use case:We have a portion of a system that receives callbacks about incoming calls from provider A, and hangs up the call, and then schedules a job to start a call from provider B. Provider B has a rate limit of 2 requests per second. However, quite often provider A hits us twice with a callback for the same call, 3-15 seconds apart. So I would like to have 2 throttle guards:
How could I get this accomplished?
The text was updated successfully, but these errors were encountered: