test
This commit is contained in:
parent
08df52a4fd
commit
27e461c76b
|
@ -50,6 +50,11 @@ class RedisPriorityQueue:
|
||||||
return item
|
return item
|
||||||
time.sleep(0.1) # wait for something to be added to the queue
|
time.sleep(0.1) # wait for something to be added to the queue
|
||||||
|
|
||||||
|
def print_all_items(self):
|
||||||
|
items = self.redis.zrange('queue', 0, -1)
|
||||||
|
for item in items:
|
||||||
|
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)
|
self.redis.hincrby(redis_key, client_ip, 1)
|
||||||
|
|
||||||
|
|
|
@ -25,4 +25,6 @@ def console_printer():
|
||||||
processing_count += redis.get(k, default=0, dtype=int)
|
processing_count += redis.get(k, default=0, dtype=int)
|
||||||
backends = [k for k, v in cluster_config.all().items() if v['online']]
|
backends = [k for k, v in cluster_config.all().items() if v['online']]
|
||||||
logger.info(f'REQUEST QUEUE -> Processing: {processing_count} | Queued: {len(priority_queue)} | Backends Online: {len(backends)}')
|
logger.info(f'REQUEST QUEUE -> Processing: {processing_count} | Queued: {len(priority_queue)} | Backends Online: {len(backends)}')
|
||||||
|
priority_queue.print_all_items()
|
||||||
|
print('============================')
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
|
@ -53,4 +53,4 @@ def start_background():
|
||||||
t = Thread(target=db_logger)
|
t = Thread(target=db_logger)
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
print('Started background logger')
|
print('Started background logger.')
|
||||||
|
|
Reference in New Issue