BurnySc2 / monorepo

Personal projects all in one location
MIT License
4 stars 0 forks source link

Rewrite transcriber to use thread executor instead #40

Open BurnySc2 opened 8 months ago

BurnySc2 commented 8 months ago

Affected folders: https://github.com/BurnySc2/monorepo/tree/develop/transcribe_website/transcriber_backend

Idea: https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor https://github.com/BurnySc2/monorepo/blob/daab0f49399bd98bb8ea9b1a15877dcf4b7703fb/python_examples/examples/other/multithreading_example_02.py

Why? Easier to read and use than the asyncio syntax. Instead of async for ... we just use for loops Instead of async with semaphore we just use with semaphore Instead of await function() we just call the function Instead of asyncio.create_task(func) we just submit a new function call to the executor, which will only leave the with statement when all tasks are completed. Should be easier to test/mock functions