From 76e51fa532c1b81db9a6bdbb5d157e7426b42077 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Wed, 24 Jul 2024 10:17:45 -0300 Subject: [PATCH] fix: correctly use maybe match clause --- apps/emqx_cluster_link/src/emqx_cluster_link_config.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/emqx_cluster_link/src/emqx_cluster_link_config.erl b/apps/emqx_cluster_link/src/emqx_cluster_link_config.erl index c35b218db..2a97f2d69 100644 --- a/apps/emqx_cluster_link/src/emqx_cluster_link_config.erl +++ b/apps/emqx_cluster_link/src/emqx_cluster_link_config.erl @@ -208,7 +208,7 @@ pre_config_update(?LINKS_PATH, {create, LinkRawConf}, OldRawConf) -> pre_config_update(?LINKS_PATH, {update, LinkRawConf}, OldRawConf) -> #{<<"name">> := Name} = LinkRawConf, maybe - {ok, {_Found, Front, Rear}} = safe_take(Name, OldRawConf), + {_Found, Front, Rear} ?= safe_take(Name, OldRawConf), NewRawConf0 = Front ++ [LinkRawConf] ++ Rear, NewRawConf = convert_certs(maybe_increment_ps_actor_incr(NewRawConf0, OldRawConf)), {ok, NewRawConf} @@ -218,7 +218,7 @@ pre_config_update(?LINKS_PATH, {update, LinkRawConf}, OldRawConf) -> end; pre_config_update(?LINKS_PATH, {delete, Name}, OldRawConf) -> maybe - {ok, {_Found, Front, Rear}} = safe_take(Name, OldRawConf), + {_Found, Front, Rear} ?= safe_take(Name, OldRawConf), NewRawConf = Front ++ Rear, {ok, NewRawConf} else @@ -420,5 +420,5 @@ safe_take(Name, Transformations) -> {_Front, []} -> not_found; {Front, [Found | Rear]} -> - {ok, {Found, Front, Rear}} + {Found, Front, Rear} end.