Skip to content

Commit

Permalink
accidentally overwriting callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
quartata committed Mar 16, 2018
1 parent 599f508 commit d902c48
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions deletionwatcher.py
Expand Up @@ -83,12 +83,14 @@ def subscribe(self, post_url, callback=None, pickle=True, timeout=None):
action = "{}-question-{}".format(site_id, question_id)
max_time = (time.time() + timeout) if timeout else None

if action in self.posts and callback:
if action not in self.posts:
self.posts[action] = (post_id, post_site, post_type, post_url, [(callback, max_time)] if callback else [])
self.socket.send(action)
elif callback:
_, _, _, _, callbacks = self.posts[action]
callbacks.append((callback, max_time))
else:
self.posts[action] = (post_id, post_site, post_type, post_url, [(callback, max_time)] if callback else [])
self.socket.send(action)
return

if pickle:
Tasks.do(self._save)
Expand Down

0 comments on commit d902c48

Please sign in to comment.