mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DRYer
This commit is contained in:
parent
9eb13264aa
commit
9c1f6974f4
@ -30,7 +30,8 @@ from polyglot.binary import as_hex_unicode
|
|||||||
from polyglot.builtins import environ_item, string_or_bytes
|
from polyglot.builtins import environ_item, string_or_bytes
|
||||||
from polyglot.queue import Empty, Queue
|
from polyglot.queue import Empty, Queue
|
||||||
|
|
||||||
_counter = 0
|
|
||||||
|
server_counter = count()
|
||||||
|
|
||||||
|
|
||||||
class ConnectedWorker(Thread):
|
class ConnectedWorker(Thread):
|
||||||
@ -193,9 +194,7 @@ class Server(Thread):
|
|||||||
limit=sys.maxsize, enforce_cpu_limit=True):
|
limit=sys.maxsize, enforce_cpu_limit=True):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
self.daemon = True
|
self.daemon = True
|
||||||
global _counter
|
self.id = next(server_counter) + 1
|
||||||
self.id = _counter+1
|
|
||||||
_counter += 1
|
|
||||||
|
|
||||||
if enforce_cpu_limit:
|
if enforce_cpu_limit:
|
||||||
limit = min(limit, cpu_count())
|
limit = min(limit, cpu_count())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user