@@ -213,8 +213,12 @@ connected({call, From}, {unlock, GeneratedKey}, Data = #statem_data{connection_n
213213connected ({call , From }, register , Data = # statem_data {connection_name = Conn }) ->
214214 Ctx = registration_context (Conn , Data ),
215215 Key = node_key (Data ),
216- eetcd_kv :put (Ctx , Key , registration_value (Data )),
217- rabbit_log :debug (" etcd peer discovery: put key ~tp , done with registration" , [Key ]),
216+ case eetcd_kv :put (Ctx , Key , registration_value (Data )) of
217+ {ok , _ } ->
218+ rabbit_log :debug (" etcd peer discovery: put key ~tp , done with registration" , [Key ]);
219+ {error , Reason } ->
220+ rabbit_log :error (" etcd peer discovery: put key ~tp failed: ~p " , [Key , Reason ])
221+ end ,
218222 gen_statem :reply (From , ok ),
219223 keep_state_and_data ;
220224connected ({call , From }, unregister , Data = # statem_data {connection_name = Conn }) ->
@@ -379,9 +383,9 @@ disconnect(ConnName, #statem_data{connection_monitor = Ref}) ->
379383unregister (Conn , Data = # statem_data {node_key_lease_id = LeaseID , node_lease_keepalive_pid = KAPid }) ->
380384 Ctx = unregistration_context (Conn , Data ),
381385 Key = node_key (Data ),
382- eetcd_kv :delete (Ctx , Key ),
386+ _ = eetcd_kv :delete (Ctx , Key ),
383387 rabbit_log :debug (" etcd peer discovery: deleted key ~ts , done with unregistration" , [Key ]),
384- eetcd_lease :revoke (Ctx , LeaseID ),
388+ _ = eetcd_lease :revoke (Ctx , LeaseID ),
385389 exit (KAPid , normal ),
386390 rabbit_log :debug (" etcd peer discovery: revoked a lease ~tp for node key ~ts " , [LeaseID , Key ]),
387391 ok .
0 commit comments