10
10
from sourceplusplus .models .instrument .LiveBreakpoint import LiveBreakpoint
11
11
from sourceplusplus .models .instrument .LiveLog import LiveLog
12
12
from sourceplusplus .models .instrument .LiveMeter import LiveMeter
13
+ from sourceplusplus .models .instrument .common import LiveInstrument
13
14
from sourceplusplus .models .instrument .common .LiveInstrumentType import LiveInstrumentType
14
15
from sourceplusplus .models .instrument .common .LiveSourceLocation import LiveSourceLocation
15
16
@@ -25,7 +26,7 @@ def __init__(self, eb: EventBus):
25
26
LiveInstrumentRemote .dbg = nopdb .get_nopdb ()
26
27
LiveInstrumentRemote .dbg .start ()
27
28
threading .settrace (sys .gettrace ())
28
- LiveInstrumentRemote .cleanupThread = threading .Thread (target = self .cleanup )
29
+ LiveInstrumentRemote .cleanupThread = threading .Thread (target = self .cleanup , daemon = True )
29
30
LiveInstrumentRemote .cleanupThread .start ()
30
31
31
32
def add_live_instrument (self , command : LiveInstrumentCommand ):
@@ -89,10 +90,11 @@ def cleanup(self):
89
90
time .sleep (1 )
90
91
delete = []
91
92
for key , val in LiveInstrumentRemote .instruments .items ():
92
- if "expires_at" in val [1 ] and val [1 ]["expires_at" ] < round (time .time () * 1000 ):
93
+ instrument : LiveInstrument = val [1 ]
94
+ if instrument .expires_at is not None and instrument .expires_at <= round (time .time () * 1000 ):
93
95
delete .append (key )
94
96
for key in delete :
95
- instrument = LiveInstrumentRemote .instruments .pop (key )
97
+ instrument : LiveInstrument = LiveInstrumentRemote .instruments .pop (key )[ 1 ]
96
98
LiveInstrumentRemote .eb .send (address = "spp.processor.status.live-instrument-removed" , body = {
97
99
"instrument" : instrument .to_json (),
98
100
"occurredAt" : round (time .time () * 1000 )
0 commit comments