I am looking for a way to limit when calling a function, but only when the input parameters differ, that is:
@app.task(rate_limit="60/s") def api_call(user): do_the_api_call() for i in range(0,100): api_call("antoine") api_call("oscar")
Therefore, I would like api_call("antoine") called 60 times per second and api_call("oscar") 60 times per second .
Any help on how I can do this?
- EDIT 04/27/2015 I tried to call the subtask with rate_limit inside the task, but it also does not work: Rate_limit is always applied to all created subtasks or tasks (which is logical).
@app.task(rate_limit="60/s") def sub_api_call(user): do_the_api_call() @app.task def api_call(user): sub_api_call(user) for i in range(0,100): api_call("antoine") api_call("oscar")
Best!
source share