Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move logging I/O to another thread to avoid blocking the event loop #4716

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Nov 20, 2023

Proposed change

Move logging I/O to another thread to avoid blocking the event loop by porting the same solution we have in core

fixes #4715

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to the supervisor)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to cli pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast supervisor tests)
  • Tests have been added to verify that the new code works.

If API endpoints of add-on configuration are added/changed:

@bdraco bdraco added the bugfix A bug fix label Nov 20, 2023
@bdraco
Copy link
Member Author

bdraco commented Nov 20, 2023

verified logger running in thread now
Screenshot 2023-11-19 at 6 33 54 PM

@bdraco bdraco marked this pull request as ready for review November 20, 2023 00:34
def prepare(self, record: logging.LogRecord) -> logging.LogRecord:
"""Prepare a record for queuing.

This is added as a workaround for https://bugs.python.org/issue46755
Copy link
Member

Choose a reason for hiding this comment

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

It seems like this got resolved in newer Python version, do we still need this work around?

Copy link
Member

Choose a reason for hiding this comment

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

It's not solved

@pvizeli pvizeli merged commit 5c579e5 into main Nov 20, 2023
23 of 24 checks passed
@pvizeli pvizeli deleted the port_logging branch November 20, 2023 19:33
@bdraco
Copy link
Member Author

bdraco commented Nov 20, 2023

thanks

@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Heavy logging blocks the event loop
3 participants