mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
fix: optimize IP key handling and enable decode responses for Redis client
This commit is contained in:
parent
82a98317ea
commit
eee1e191e0
2 changed files with 10 additions and 2 deletions
|
|
@ -22,7 +22,7 @@ def bans_page():
|
|||
bans = []
|
||||
if redis_client:
|
||||
for key in redis_client.scan_iter("bans_ip_*"):
|
||||
ip = key.decode("utf-8").replace("bans_ip_", "")
|
||||
ip = key.replace("bans_ip_", "")
|
||||
data = redis_client.get(key)
|
||||
if not data:
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -394,7 +394,14 @@ def get_redis_client():
|
|||
socket_keepalive=True,
|
||||
max_connections=redis_keepalive_pool,
|
||||
)
|
||||
redis_client = sentinel.slave_for(sentinel_master, db=redis_db, username=username, password=password)
|
||||
|
||||
redis_client = sentinel.slave_for(
|
||||
sentinel_master,
|
||||
db=redis_db,
|
||||
username=username,
|
||||
password=password,
|
||||
decode_responses=True,
|
||||
)
|
||||
else:
|
||||
redis_client = Redis(
|
||||
host=redis_host,
|
||||
|
|
@ -407,6 +414,7 @@ def get_redis_client():
|
|||
socket_keepalive=True,
|
||||
max_connections=redis_keepalive_pool,
|
||||
ssl=redis_ssl,
|
||||
decode_responses=True,
|
||||
)
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue