File tree 1 file changed +7
-2
lines changed
hkube_python_wrapper/communication/streaming
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change
1
+ import threading
1
2
import time
2
3
from hkube_python_wrapper .util .DaemonThread import DaemonThread
3
4
@@ -8,15 +9,19 @@ def __init__(self, messageListeners):
8
9
self ._working = True
9
10
self ._messageListeners = messageListeners
10
11
DaemonThread .__init__ (self , "StreamingListener" )
11
-
12
+ def fetch (self ,messageListener ):
13
+ messageListener .fetch ()
12
14
def run (self ):
13
15
while (self ._listeningToMessages ):
14
16
messageListeners = self ._messageListeners ()
15
17
if (not messageListeners ):
16
18
time .sleep (1 ) # free some cpu
17
19
continue
18
20
for listener in messageListeners :
19
- listener .fetch ()
21
+ listener .thread = threading .Thread (target = self .fetch , args = [listener ])
22
+ listener .thread .start ()
23
+ for listener in messageListeners :
24
+ listener .thread .join ()
20
25
self ._working = False
21
26
22
27
def stop (self , force = True ):
You can’t perform that action at this time.
0 commit comments