moved callback registration to AFTER our instance updates ETCD

This commit is contained in:
B.J. Dweck 2021-02-07 14:02:53 +02:00
parent 0a93abe30f
commit 70eb98da76

View File

@ -62,14 +62,14 @@ class SyncthingMonitor:
self.syncthing.disable_announce_discovery_and_relay() self.syncthing.disable_announce_discovery_and_relay()
self.syncthing.sync_config() 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) 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) 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), print("Added this device to cluster with publish address: {0}".format(self.syncthing_publish_address),
flush=True) flush=True)
print("Registering etcd update callback...", flush=True)
self.etcd.register_device_update_handler(self.update_devices)
self.update_devices(None) self.update_devices(None)
print("Entering loop...", flush=True) print("Entering loop...", flush=True)