Commit 20a4e5bb authored by Vitaly Lipatov's avatar Vitaly Lipatov

web: fail unban when stream enqueue is rejected

parent 1b266f0c
...@@ -71,11 +71,14 @@ try { ...@@ -71,11 +71,14 @@ try {
if ($redis_password !== '' && !$redis->auth($redis_username !== '' ? [$redis_username, $redis_password] : $redis_password)) { if ($redis_password !== '' && !$redis->auth($redis_username !== '' ? [$redis_username, $redis_password] : $redis_password)) {
throw new RedisException('authentication failed'); throw new RedisException('authentication failed');
} }
$redis->xAdd('eterban:commands', '*', [ $entry_id = $redis->xAdd('eterban:commands', '*', [
'command' => 'unban', 'command' => 'unban',
'ip' => $ip, 'ip' => $ip,
'by' => $ip . ' was unblocked by ' . $hostname, 'by' => $ip . ' was unblocked by ' . $hostname,
]); ]);
if ($entry_id === false) {
throw new RedisException('unable to enqueue unban command');
}
$redis->close(); $redis->close();
} catch (RedisException $error) { } catch (RedisException $error) {
http_response_code(503); http_response_code(503);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment