1010from sourceplusplus .models .instrument .LiveBreakpoint import LiveBreakpoint
1111from sourceplusplus .models .instrument .LiveLog import LiveLog
1212from sourceplusplus .models .instrument .LiveMeter import LiveMeter
13+ from sourceplusplus .models .instrument .common import LiveInstrument
1314from sourceplusplus .models .instrument .common .LiveInstrumentType import LiveInstrumentType
1415from sourceplusplus .models .instrument .common .LiveSourceLocation import LiveSourceLocation
1516
@@ -25,7 +26,7 @@ def __init__(self, eb: EventBus):
2526 LiveInstrumentRemote .dbg = nopdb .get_nopdb ()
2627 LiveInstrumentRemote .dbg .start ()
2728 threading .settrace (sys .gettrace ())
28- LiveInstrumentRemote .cleanupThread = threading .Thread (target = self .cleanup )
29+ LiveInstrumentRemote .cleanupThread = threading .Thread (target = self .cleanup , daemon = True )
2930 LiveInstrumentRemote .cleanupThread .start ()
3031
3132 def add_live_instrument (self , command : LiveInstrumentCommand ):
@@ -89,10 +90,11 @@ def cleanup(self):
8990 time .sleep (1 )
9091 delete = []
9192 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 ):
9395 delete .append (key )
9496 for key in delete :
95- instrument = LiveInstrumentRemote .instruments .pop (key )
97+ instrument : LiveInstrument = LiveInstrumentRemote .instruments .pop (key )[ 1 ]
9698 LiveInstrumentRemote .eb .send (address = "spp.processor.status.live-instrument-removed" , body = {
9799 "instrument" : instrument .to_json (),
98100 "occurredAt" : round (time .time () * 1000 )
0 commit comments