Skip to content

Commit

Permalink
Merge pull request #114 from sepalani/worker-thread-start
Browse files Browse the repository at this point in the history
Start server worker thread when expecting work not before
  • Loading branch information
sepalani committed Jul 15, 2023
2 parents 96a135b + eb55107 commit 9a336b7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mh/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def __init__(self, server_address, RequestHandlerClass, max_threads,
)
self.worker_queues.append(thread_queue)
self.worker_threads.append(thread)
thread.start()

if bind_and_activate:
try:
Expand Down Expand Up @@ -198,6 +197,9 @@ def fileno(self):
def serve_forever(self):
self.__is_shut_down.clear()
try:
for thread in self.worker_threads:
thread.start()

with self.selector as selector:
selector.register(self, selectors.EVENT_READ)

Expand Down

0 comments on commit 9a336b7

Please sign in to comment.