Use monotonic clock for interval measurement (#6211)
Signed-off-by: Lifu Huang <lifu.hlf@gmail.com>
This commit is contained in:
@@ -182,9 +182,9 @@ async def health_generate(request: Request) -> Response:
|
||||
async for _ in _global_state.tokenizer_manager.generate_request(gri, request):
|
||||
break
|
||||
|
||||
tic = time.time()
|
||||
tic = time.perf_counter()
|
||||
task = asyncio.create_task(gen())
|
||||
while time.time() < tic + HEALTH_CHECK_TIMEOUT:
|
||||
while time.perf_counter() < tic + HEALTH_CHECK_TIMEOUT:
|
||||
await asyncio.sleep(1)
|
||||
if _global_state.tokenizer_manager.last_receive_tstamp > tic:
|
||||
task.cancel()
|
||||
|
||||
@@ -24,10 +24,10 @@ def launch_server_process(server_args: ServerArgs) -> multiprocessing.Process:
|
||||
|
||||
base_url = server_args.url()
|
||||
timeout = 300.0 # Increased timeout to 5 minutes for downloading large models
|
||||
start_time = time.time()
|
||||
start_time = time.perf_counter()
|
||||
|
||||
with requests.Session() as session:
|
||||
while time.time() - start_time < timeout:
|
||||
while time.perf_counter() - start_time < timeout:
|
||||
try:
|
||||
headers = {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
|
||||
Reference in New Issue
Block a user