geoloc-members: add timeout to jaklis for getting profiles

This commit is contained in:
poka 2022-04-15 00:20:48 +02:00
parent 283af1b556
commit a9d85d974e
1 changed files with 5 additions and 4 deletions

View File

@ -4,6 +4,7 @@
GPATH="$( cd "$(dirname "$0")" ; pwd -P )/.."
[[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env
source $GPATH/.env
timeout=5
FILE="/tmp/geoloc-members.json"
FINAL_LOCATION="$WEBPATH/data/geoloc-members.json"
@ -22,7 +23,7 @@ for i in $DATA_MBR; do
IFS=$oldIFS
pubkey=$(echo $i | awk '{ print $1 }')
userId=\"$(echo $i | awk '{ print $2 }')\"
result=$($JAKLIS get -p $pubkey)
result=$(timeout $timeout $JAKLIS get -p $pubkey)
geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null)
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
@ -43,7 +44,7 @@ for i in $DATA_NONMBR; do
IFS=$oldIFS
pubkey=$(echo $i | awk '{ print $1 }')
userId=\"$(echo $i | awk '{ print $2 }')\"
result=$($JAKLIS get -p $pubkey)
result=$(timeout $timeout $JAKLIS get -p $pubkey)
geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null)
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
@ -61,7 +62,7 @@ done
for i in $DATA_LARF; do
result=$($JAKLIS get -p $i)
result=$(timeout $timeout $JAKLIS get -p $i)
geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null)
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
@ -87,7 +88,7 @@ finalResult=$(cat $FILE | jq .)
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "$finalResult" > $FINAL_LOCATION_ALT
echo "$finalResult" > $FINAL_LOCATION
else
echo "Failed" >> $FILE
fi