From 70eb98da76c6be12509b2726316ec9805c5e5b5a Mon Sep 17 00:00:00 2001 From: Benjamin Dweck Date: Sun, 7 Feb 2021 14:02:53 +0200 Subject: [PATCH] moved callback registration to AFTER our instance updates ETCD --- syncthing_monitor/__main__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syncthing_monitor/__main__.py b/syncthing_monitor/__main__.py index 74ac122..1bf2688 100644 --- a/syncthing_monitor/__main__.py +++ b/syncthing_monitor/__main__.py @@ -62,14 +62,14 @@ class SyncthingMonitor: self.syncthing.disable_announce_discovery_and_relay() self.syncthing.sync_config() - print("Registering etcd update callback...", flush=True) - self.etcd.register_device_update_handler(self.update_devices) - print("Attempting to add this device to etcd...", flush=True) self.etcd.add_device_to_cluster(self.my_device_id, self.syncthing_node_name, self.syncthing_publish_address) print("Added this device to cluster with publish address: {0}".format(self.syncthing_publish_address), flush=True) + print("Registering etcd update callback...", flush=True) + self.etcd.register_device_update_handler(self.update_devices) + self.update_devices(None) print("Entering loop...", flush=True)