This commit is contained in:
Cyberes 2023-10-04 12:47:59 -06:00
parent 6af5365015
commit 7cb624c5f5
2 changed files with 2 additions and 2 deletions

View File

@ -112,7 +112,7 @@ class RedisCustom(Redis):
def zcard(self, name: KeyT): def zcard(self, name: KeyT):
return self.redis.zcard(self._key(name)) return self.redis.zcard(self._key(name))
def hdel(self, name: str, *keys: List): def hdel(self, name: str, *keys: str):
return self.redis.hdel(self._key(name), *keys) return self.redis.hdel(self._key(name), *keys)
def hget( def hget(

View File

@ -62,7 +62,7 @@ class RedisPriorityQueue:
def decrement_ip_count(self, client_ip: str, redis_key): def decrement_ip_count(self, client_ip: str, redis_key):
new_count = self.redis.hincrby(redis_key, client_ip, -1) new_count = self.redis.hincrby(redis_key, client_ip, -1)
if new_count <= 0: if new_count <= 0:
self.redis.hdel(redis_key, [client_ip]) self.redis.hdel(redis_key, client_ip)
def __len__(self): def __len__(self):
return self.redis.zcard('queue') return self.redis.zcard('queue')