Skip to content

Commit fccd94b

Browse files
committed
structured upcoming TODO
1 parent 1d7265c commit fccd94b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

firebase.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@ def close(self):
3333

3434
class RemoteThread(threading.Thread):
3535

36-
def __init__(self, URL, function):
36+
def __init__(self, parent, URL, function):
3737
self.function = function
3838
self.URL = URL
39+
self.parent = parent
3940
super(RemoteThread, self).__init__()
4041

4142
def run(self):
4243
try:
4344
self.sse = ClosableSSEClient(self.URL)
4445
for msg in self.sse:
4546
msg_data = json.loads(msg.data)
46-
msg_event = msg.event
4747
if msg_data is None: # keep-alives
4848
continue
49+
msg_event = msg.event
50+
# TODO: update parent cache here
4951
self.function((msg.event, msg_data))
5052
except socket.error:
5153
pass # this can happen when we close the stream
@@ -85,7 +87,8 @@ def firebaseURL(URL):
8587
class subscriber:
8688

8789
def __init__(self, URL, function):
88-
self.remote_thread = RemoteThread(firebaseURL(URL), function)
90+
self.cache = {}
91+
self.remote_thread = RemoteThread(self, firebaseURL(URL), function)
8992

9093
def start(self):
9194
self.remote_thread.start()

0 commit comments

Comments
 (0)