geoloc-members: add timeout to jaklis for getting profiles
This commit is contained in:
parent
283af1b556
commit
a9d85d974e
|
@ -4,6 +4,7 @@
|
||||||
GPATH="$( cd "$(dirname "$0")" ; pwd -P )/.."
|
GPATH="$( cd "$(dirname "$0")" ; pwd -P )/.."
|
||||||
[[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env
|
[[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env
|
||||||
source $GPATH/.env
|
source $GPATH/.env
|
||||||
|
timeout=5
|
||||||
|
|
||||||
FILE="/tmp/geoloc-members.json"
|
FILE="/tmp/geoloc-members.json"
|
||||||
FINAL_LOCATION="$WEBPATH/data/geoloc-members.json"
|
FINAL_LOCATION="$WEBPATH/data/geoloc-members.json"
|
||||||
|
@ -22,7 +23,7 @@ for i in $DATA_MBR; do
|
||||||
IFS=$oldIFS
|
IFS=$oldIFS
|
||||||
pubkey=$(echo $i | awk '{ print $1 }')
|
pubkey=$(echo $i | awk '{ print $1 }')
|
||||||
userId=\"$(echo $i | awk '{ print $2 }')\"
|
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)
|
geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null)
|
||||||
|
|
||||||
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
|
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
|
||||||
|
@ -43,7 +44,7 @@ for i in $DATA_NONMBR; do
|
||||||
IFS=$oldIFS
|
IFS=$oldIFS
|
||||||
pubkey=$(echo $i | awk '{ print $1 }')
|
pubkey=$(echo $i | awk '{ print $1 }')
|
||||||
userId=\"$(echo $i | awk '{ print $2 }')\"
|
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)
|
geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null)
|
||||||
|
|
||||||
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
|
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
|
||||||
|
@ -61,7 +62,7 @@ done
|
||||||
|
|
||||||
|
|
||||||
for i in $DATA_LARF; do
|
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)
|
geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null)
|
||||||
|
|
||||||
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
|
if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then
|
||||||
|
@ -87,7 +88,7 @@ finalResult=$(cat $FILE | jq .)
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [ $RESULT -eq 0 ]; then
|
if [ $RESULT -eq 0 ]; then
|
||||||
echo "$finalResult" > $FINAL_LOCATION_ALT
|
echo "$finalResult" > $FINAL_LOCATION
|
||||||
else
|
else
|
||||||
echo "Failed" >> $FILE
|
echo "Failed" >> $FILE
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue