Skip to content

Commit

Permalink
Use modern thread name attribute API instead of the deprecated methods
Browse files Browse the repository at this point in the history
Co-authored-by: Sviatoslav Sydorenko <sviat@redhat.com>
  • Loading branch information
soham4abc and webknjaz authored Jun 7, 2021
1 parent b067866 commit 7af66b0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cheroot/workers/threadpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def run(self):
Retrieves incoming connections from thread pool.
"""
self.server.stats['Worker Threads'][self.getName()] = self.stats
self.server.stats['Worker Threads'][self.name] = self.stats
try:
self.ready = True
while True:
Expand Down Expand Up @@ -176,9 +176,9 @@ def start(self):
for i in range(self.min):
self._threads.append(WorkerThread(self.server))
for worker in self._threads:
worker.setName(
worker.name = (
'CP Server {worker_name!s}'.
format(worker_name=worker.getName()),
format(worker_name=worker.name),
)
worker.start()
for worker in self._threads:
Expand Down Expand Up @@ -226,9 +226,9 @@ def grow(self, amount):

def _spawn_worker(self):
worker = WorkerThread(self.server)
worker.setName(
worker.name = (
'CP Server {worker_name!s}'.
format(worker_name=worker.getName()),
format(worker_name=worker.name),
)
worker.start()
return worker
Expand Down

0 comments on commit 7af66b0

Please sign in to comment.