3 ms·
If say you wanted to perform an action 10 times a minute and also maintain a gap(in other words, time between action to be 6 seconds), could you simply not have
by heroic 12y ago
If say you wanted to perform an action 10 times a minute and also maintain a gap(in other words, time between action to be 6 seconds), could you simply not have done this:
1) Use SETNX, if you are able to do it, then set a TTL of 6 seconds on the key. Do these in a MULTI.
2) Perform action.
Now you have rate limiting as well as gap between actions. Also, no blocked actions, will affect anything. If I got something wrong from your post, do let me know.