Skip to content

Commit

Permalink
Merge pull request #32 from clustlight/backend/change-to-threadpoolex…
Browse files Browse the repository at this point in the history
…ecutor

Update: [Backend] Tasks that were being handled in multi-processes are changed to run in multi-threading
  • Loading branch information
quadseed authored Feb 18, 2024
2 parents dfceec0 + 94d5820 commit efa59f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import os
import pathlib
from concurrent.futures import ProcessPoolExecutor
from concurrent.futures import ThreadPoolExecutor

import dotenv
import uvicorn
Expand Down Expand Up @@ -32,7 +32,7 @@ def main():
utils.create_temp_directory()
Base.metadata.create_all(engine)

with ProcessPoolExecutor() as executor:
with ThreadPoolExecutor() as executor:
executor.submit(start_api_server)
if os.environ.get("AUTO_RECORDING").lower() in ('true', 'enable', 'on'):
executor.submit(start_websocket_client)
Expand Down
4 changes: 2 additions & 2 deletions backend/src/stream.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from concurrent.futures import ProcessPoolExecutor
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import Manager

from parallel import stream_video, start_stream_comments
Expand All @@ -7,7 +7,7 @@

class StreamManager:
def __init__(self):
self.executor = ProcessPoolExecutor(max_workers=256)
self.executor = ThreadPoolExecutor(max_workers=64)
self.events = {}
self.manager = Manager()

Expand Down

0 comments on commit efa59f5

Please sign in to comment.