-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backports_lnbits_changes #8
base: main
Are you sure you want to change the base?
Conversation
try: | ||
message = self.queue.get(timeout=1) | ||
self.num_sent_events += 1 | ||
self.ws.send(message) | ||
except: | ||
if shutdown(): | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can shutdown worker now via shutdown()
if self.error_threshold and self.error_counter > self.error_threshold: | ||
pass | ||
else: | ||
self.check_reconnect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reconnect on error
self.relays[url].close() | ||
self.relays.pop(url) | ||
self.threads[url].join(timeout=1) | ||
self.threads.pop(url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove relays during runtime.
self.threads[relay.url] = threading.Thread( | ||
target=relay.connect, | ||
args=(ssl_options, proxy), | ||
name=f"{relay.url}-thread", | ||
daemon=True, | ||
).start() | ||
) | ||
self.threads[relay.url].start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We save all threads now.
self.queue_threads[relay.url] = threading.Thread( | ||
target=relay.queue_worker, | ||
args=(lambda: relay.shutdown,), | ||
name=f"{relay.url}-queue", | ||
daemon=True, | ||
) | ||
self.queue_threads[relay.url].start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also save all queue worker threads and add a shutdown argument
if callback_events_func: | ||
callback_events_func(event_msg) | ||
while self.relay_manager.message_pool.has_notices(): | ||
event_msg = self.relay_manager.message_pool.has_notices() | ||
event_msg = self.relay_manager.message_pool.get_notice() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Endless loop due to has_notice
fixed.
…bits_changes Changes from callebtc#8
Looks good. Any reason not to merge? |
Backports changes that we made in lnbits/nostrclient