[Rspamd] Dynamic ratelimit fixed, removed async redis request; Ready to implement per-user ratelimits via UI (tbd)

This commit is contained in:
andryyy
2017-08-30 21:42:39 +02:00
parent 66ae588445
commit b1213c51d7
8 changed files with 565 additions and 396 deletions

View File

@@ -1214,7 +1214,6 @@ function mailbox($_action, $_type, $_data = null) {
}
if (empty($rl_value)) {
try {
$redis->hDel('RL_OBJECT', $domain);
$redis->hDel('RL_VALUE', $domain);
}
catch (RedisException $e) {
@@ -1227,7 +1226,6 @@ function mailbox($_action, $_type, $_data = null) {
}
else {
try {
$redis->hSet('RL_OBJECT', $domain, '1');
$redis->hSet('RL_VALUE', $domain, $rl_value . ' / 1' . $rl_frame);
}
catch (RedisException $e) {
@@ -2389,7 +2387,7 @@ function mailbox($_action, $_type, $_data = null) {
return false;
}
try {
if (($rl_value = $redis->hGet('RL_VALUE', $_data)) && $redis->hGet('RL_OBJECT', $_data)) {
if ($rl_value = $redis->hGet('RL_VALUE', $_data)) {
$rl = explode(' / 1', $rl_value);
$data['value'] = $rl[0];
$data['frame'] = $rl[1];