Skip to content

Conversation

@tt2468
Copy link
Member

@tt2468 tt2468 commented Jan 8, 2026

Description

There's actually no need to run the _run_app() function using a loop we create. Just add an on_startup hook to override the thread pool. Python asyncio automatically shuts down our custom thread pool executor on loop shutdown, so there's no need for any shutdown logic either.

asyncio.to_thread will automatically use the running loop's thread pool executor, which is the one we've created ourselves.

Motivation and Context

I guess my shitty python code from a few years ago is getting deprecation warnings now.

How Has This Been Tested?

Analyzed some logs of mine

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@tt2468 tt2468 force-pushed the enhancement/aiohttp-update branch 2 times, most recently from 2b0c6c3 to d0b76ca Compare January 8, 2026 19:21
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

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

Use simplehttp: as the commit prefix here.

Is there no need to call loop.close() in this implementation?

There's actually no need to run the _run_app() function using a loop we
create. Just add an on_startup hook to override the thread pool. Python
asyncio automatically shuts down our custom thread pool executor on
loop shutdown, so there's no need for any shutdown logic either.

asyncio.to_thread will automatically use the running loop's thread pool
executor, which is the one we've created ourselves.
@tt2468 tt2468 force-pushed the enhancement/aiohttp-update branch from 999b62c to b50db88 Compare January 8, 2026 19:49
@tt2468
Copy link
Member Author

tt2468 commented Jan 8, 2026

Correct. web.run_app() does its own loop management, so we don't need to do any shutdown. Newer python also handles threadpool executor shut down automatically, too.

@RytoEX RytoEX merged commit 42e3ec3 into obsproject:master Jan 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants