This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local current, expected, cur_val, callcount, maxcps | |
| current = redis.call('GET', KEYS[1]) | |
| callcount = tonumber(ARGV[1]) | |
| maxcps = tonumber(ARGV[2]) | |
| cur_val = 0 | |
| if current then | |
| cur_val = tonumber(current) | |
| end | |
| expected = cur_val + callcount | |
| if expected > maxcps then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| script = "\ | |
| local current, expected, cur_val, callcount, maxcps \ | |
| current = redis.call('GET', KEYS[1]) \ | |
| callcount = tonumber(ARGV[1]) \ | |
| maxcps = tonumber(ARGV[2]) \ | |
| cur_val = 0 \ | |
| if current then \ | |
| cur_val = tonumber(current) \ | |
| end \ | |
| expected = cur_val + callcount \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ret = is_rate_okay(keys=[rate_key], | |
| args=[call_count, max_cps]) | |
| if ret is None: | |
| plivo_call.retry(countdown=randint(60,120)) | |
| return False |