Skip to content

Commit 08e4a24

Browse files
committed
Explicitly disconnect event stream and fix incorrect reconnect detection
1 parent fd456f9 commit 08e4a24

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

scratchattach/cloud/_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ def disconnect(self):
354354
except Exception:
355355
pass
356356
if self.event_stream:
357+
self.event_stream.close()
357358
self.event_stream = None
358359

359360
def _assert_valid_value(self, value):

scratchattach/eventhandlers/cloud_events.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _updater(self):
2626
"""
2727
A process that listens for cloud activity and executes events on cloud activity
2828
"""
29-
29+
3030
self.call_event("on_ready")
3131

3232
if not self.running:
@@ -47,11 +47,11 @@ def _updater(self):
4747
except Exception as e:
4848
pass
4949
except Exception:
50-
print("CloudEvents: Disconnected. Reconnecting ...", time.time())
50+
# print("CloudEvents: Disconnected. Reconnecting ...", time.time())
5151
time.sleep(0.1) # cooldown
5252

53-
print("CloudEvents: Reconnected.", time.time())
54-
self.call_event("on_reconnect", [])
53+
# print("CloudEvents: Reconnected.", time.time())
54+
self.call_event("on_reconnect", [])
5555

5656
class ManualCloudLogEvents:
5757
"""

0 commit comments

Comments
 (0)