Skip to content

Commit

Permalink
ref_state: fixes sync with ips
Browse files Browse the repository at this point in the history
  • Loading branch information
javierajorge committed May 13, 2024
1 parent 9c5e287 commit af48dd6
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ case "$1" in
json_get_vars data_type
json_get_vars peers_ip
json=$(jsonfilter -s $msg -e "@.json")
if json_is_a peers_ip array
then
json_select peers_ip
idx=1
ips=""
while json_is_a ${idx} string ## iterate over data inside "peersip" object
do
json_get_var ip_addr $idx
ips="$ips$ip_addr "
idx=$(( idx + 1 ))
done
else
ips=$peers_ip
fi
case "$2" in
get)
if output=$(shared-state-async get $data_type 2>/dev/null)
Expand All @@ -31,7 +45,7 @@ case "$1" in
fi
;;
sync)
shared-state-async sync $data_type ${peers_ip//,/ } > /dev/null 2>&1
shared-state-async sync $data_type $ips > /dev/null 2>&1
echo {\"data\": {} , \"error\": $? }
;;
publish)
Expand Down

0 comments on commit af48dd6

Please sign in to comment.