Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dashscope/audio/tts_v2/speech_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ def __auto_reconnect(self):
while True:
objects_need_to_connect = []
objects_need_to_renew = []
print('scanning queue borr: {}/{} remain: {}/{}'.format(
logger.debug('scanning queue borr: {}/{} remain: {}/{}'.format(
self._borrowed_object_num, self._pool_size,
self._remain_object_num, self._pool_size))
Comment on lines +757 to 759
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While replacing print with logger.debug is a good improvement, this can be optimized for better performance. By passing the arguments to the logger directly, string formatting is deferred until it's certain the message needs to be logged. This avoids the performance cost of formatting strings that may not be output, which is especially beneficial for debug level logs. This also makes the code more concise.

            logger.debug('scanning queue borr: %s/%s remain: %s/%s', self._borrowed_object_num, self._pool_size, self._remain_object_num, self._pool_size)

with self._lock:
Expand Down