Skip to content

Commit ccc07ab

Browse files
author
Joel Collins
committed
Use Deque for thread pool
1 parent ccf6f86 commit ccc07ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/labthings/actions/pool.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
import threading
33
from functools import wraps
44

5+
from ..deque import Deque
56
from .thread import ActionThread
67

78

8-
# TODO: Handle discarding old actions. Action views now use deques
99
class Pool:
1010
""" """
1111

12-
def __init__(self):
13-
self.threads = set()
12+
def __init__(self, maxlen: int = 100):
13+
self.threads = Deque(maxlen=maxlen)
1414

1515
def add(self, thread: ActionThread):
1616
"""
1717
1818
:param thread: ActionThread:
1919
2020
"""
21-
self.threads.add(thread)
21+
self.threads.append(thread)
2222

2323
def start(self, thread: ActionThread):
2424
"""

0 commit comments

Comments
 (0)