Commit 2ad32cc8 authored by Vitaly Lipatov's avatar Vitaly Lipatov

gateway: remove autoban state atomically

parent 4015c0d0
...@@ -144,11 +144,13 @@ class AutoBanManager: ...@@ -144,11 +144,13 @@ class AutoBanManager:
try: try:
# Удаляем из расписания и постоянных # Удаляем из расписания и постоянных
self.r.zrem(self.SCHEDULE_KEY, ip) pipeline = self.r.pipeline(transaction=True)
self.r.srem(self.PERMANENT_KEY, ip) pipeline.zrem(self.SCHEDULE_KEY, ip)
pipeline.srem(self.PERMANENT_KEY, ip)
if reset_counter: if reset_counter:
self.r.delete(f"{self.META_PREFIX}{ip}") pipeline.delete(f"{self.META_PREFIX}{ip}")
pipeline.execute()
except Exception as e: except Exception as e:
log.error(f"AutoBanManager.on_unban error: {e}") log.error(f"AutoBanManager.on_unban error: {e}")
......
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