Merge cluster to master #3
|
@ -59,10 +59,12 @@ class RedisPriorityQueue:
|
||||||
print(item.decode('utf-8'))
|
print(item.decode('utf-8'))
|
||||||
|
|
||||||
def increment_ip_count(self, client_ip: str, redis_key):
|
def increment_ip_count(self, client_ip: str, redis_key):
|
||||||
self.redis.hincrby(redis_key, client_ip, 1)
|
new_count = self.redis.hincrby(redis_key, client_ip, 1)
|
||||||
|
print(client_ip, new_count)
|
||||||
|
|
||||||
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)
|
||||||
|
print(client_ip, new_count)
|
||||||
if new_count <= 0:
|
if new_count <= 0:
|
||||||
self.redis.hdel(redis_key, client_ip)
|
self.redis.hdel(redis_key, client_ip)
|
||||||
|
|
||||||
|
|
Reference in New Issue