Skip to content

Commit

Permalink
Merge pull request #7876 from drew2a/feature/slow_coro_warning
Browse files Browse the repository at this point in the history
Downgrade "slow coro detection"  to `warning` level
  • Loading branch information
drew2a authored Feb 1, 2024
2 parents d488a0b + 5a21ac6 commit dd39516
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/tribler/core/utilities/slow_coro_detection/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ def patched_handle_run(self: Handle):

def _report_long_duration(handle: Handle, duration: float):
info_str = format_info(handle)
logger.error(f'Slow coroutine step execution (duration={duration:.3f} seconds): {info_str}')
logger.warning(f'Slow coroutine step execution (duration={duration:.3f} seconds): {info_str}')
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_report_long_duration(logger, format_info: Mock):
duration = 10
_report_long_duration(handle, duration)
format_info.assert_called_with(handle)
logger.error.assert_called_with('Slow coroutine step execution (duration=10.000 seconds): <formatted handle>')
logger.warning.assert_called_with('Slow coroutine step execution (duration=10.000 seconds): <formatted handle>')


@patch('tribler.core.utilities.slow_coro_detection.watching_thread.format_info', return_value='<formatted handle>')
Expand All @@ -85,7 +85,7 @@ def test__report_freeze_first_report(logger, format_info):

_report_freeze(handle, duration, first_report=True)
format_info.assert_called_with(handle, include_stack=True, stack_cut_duration=pytest.approx(8.0))
logger.error.assert_called_with(
logger.warning.assert_called_with(
'Slow coroutine is occupying the loop for 10.000 seconds already: <formatted handle>')


Expand All @@ -98,4 +98,4 @@ def test__report_freeze_not_first_report(logger, format_info):
_report_freeze(handle, duration, first_report=False)
format_info.assert_called_with(handle, include_stack=True, stack_cut_duration=pytest.approx(8.0),
limit=2, enable_profiling_tip=False)
logger.error.assert_called_with('Still executing <formatted handle>')
logger.warning.assert_called_with('Still executing <formatted handle>')
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def _report_freeze(handle: Handle, duration: float, first_report: bool):

if first_report:
info_str = format_info(handle, include_stack=True, stack_cut_duration=stack_cut_duration)
logger.error(f'Slow coroutine is occupying the loop for {duration:.3f} seconds already: {info_str}')
logger.warning(f'Slow coroutine is occupying the loop for {duration:.3f} seconds already: {info_str}')
return

info_str = format_info(handle, include_stack=True, stack_cut_duration=stack_cut_duration, limit=2,
enable_profiling_tip=False)
logger.error(f"Still executing {info_str}")
logger.warning(f"Still executing {info_str}")

0 comments on commit dd39516

Please sign in to comment.