python-nostr icon indicating copy to clipboard operation
python-nostr copied to clipboard

refactor relay threads

Open jeffthibault opened this issue 2 years ago • 6 comments

Relay class

  • Add thread instantiation to connect method
  • Add is_connected method which checks if the ws.run_forever thread is alive. I think this is more reliable because this thread will be torn down on disconnect.
  • Various renaming

Relay Manager

  • Remove thread instantiation from add_relay (handled in relay.connect now)
  • Add relay_connection_monitor thread, which periodically (connection_monitor_interval_secs) checks if the relays are disconnected and reconnects them if they are.

Note: I felt like reconnection logic belongs in the relay manager as it's job is to manage the relays

jeffthibault avatar Feb 17 '23 13:02 jeffthibault