MCPcopy Create free account
hub / github.com/THESIS-AGENT/AIRouter / monitor_queue

Function monitor_queue

api_key_manager/unit_test.py:445–456  ·  view source on GitHub ↗

监控队列大小的线程函数

(q, total_size, interval=5)

Source from the content-addressed store, hash-verified

443 logger.info("=" * 80)
444
445def monitor_queue(q, total_size, interval=5):
446 """监控队列大小的线程函数"""
447 start_time = time.time()
448 while True:
449 remaining = q.qsize()
450 if remaining == 0:
451 logger.info(f"队列处理完毕,耗时: {time.time() - start_time:.2f}秒")
452 break
453
454 percentage = 100 - (remaining / total_size * 100)
455 logger.info(f"队列进度: {percentage:.1f}% (剩余: {remaining})")
456 time.sleep(interval)
457
458def run_threaded_workers(process_id, num_threads, requests_per_thread, sources, req_queue=None, res_queue=None):
459 """在一个进程内运行多个线程"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected