Skip to content

Commit 2bf20eb

Browse files
authored
latency fix proxy (#7563)
1 parent 0d366c5 commit 2bf20eb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

litellm/proxy/litellm_pre_call_utils.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import copy
23
import time
34
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
@@ -616,13 +617,15 @@ async def add_litellm_data_to_request( # noqa: PLR0915
616617
)
617618

618619
end_time = time.time()
619-
await service_logger_obj.async_service_success_hook(
620-
service=ServiceTypes.PROXY_PRE_CALL,
621-
duration=end_time - start_time,
622-
call_type="add_litellm_data_to_request",
623-
start_time=start_time,
624-
end_time=end_time,
625-
parent_otel_span=user_api_key_dict.parent_otel_span,
620+
asyncio.create_task(
621+
service_logger_obj.async_service_success_hook(
622+
service=ServiceTypes.PROXY_PRE_CALL,
623+
duration=end_time - start_time,
624+
call_type="add_litellm_data_to_request",
625+
start_time=start_time,
626+
end_time=end_time,
627+
parent_otel_span=user_api_key_dict.parent_otel_span,
628+
)
626629
)
627630
return data
628631

0 commit comments

Comments
 (0)