fixes intervals
This commit is contained in:
parent
1e3c389e90
commit
a83247b4ca
@ -49,18 +49,18 @@ do
|
|||||||
rm -f firstloop
|
rm -f firstloop
|
||||||
else
|
else
|
||||||
LOOP_INTERVAL=30 # 60s max free coingecko API interval + 30s puffer
|
LOOP_INTERVAL=30 # 60s max free coingecko API interval + 30s puffer
|
||||||
time_to_interval=$((${LOOP_INTERVAL} - $(date +%s) % ${LOOP_INTERVAL}))
|
|
||||||
g_echo_note "NEXT LOOP - sleeping ${time_to_interval} seconds until next full ${LOOP_INTERVAL} seconds"
|
|
||||||
sleep ${time_to_interval}
|
|
||||||
# Check for next general interval
|
|
||||||
time_to_full_interval=$((${INTERVAL} - $(date +%s) % ${INTERVAL}))
|
time_to_full_interval=$((${INTERVAL} - $(date +%s) % ${INTERVAL}))
|
||||||
|
time_to_interval=$((${LOOP_INTERVAL} - $(date +%s) % ${LOOP_INTERVAL}))
|
||||||
|
# Check for next general interval
|
||||||
|
g_echo_note "NEXT LOOP in ${time_to_interval} seconds (Interval=${LOOP_INTERVAL}s)"
|
||||||
|
g_echo_note "NEXT FULL LOOP in ${time_to_full_interval} seconds (Interval=${INTERVAL}s)"
|
||||||
if [ ${time_to_full_interval} -le ${time_to_interval} ]
|
if [ ${time_to_full_interval} -le ${time_to_interval} ]
|
||||||
then
|
then
|
||||||
g_echo_note "NEXT FULL LOOP NOW - all ${INTERVAL} seconds"
|
|
||||||
FULL_LOOP=1
|
FULL_LOOP=1
|
||||||
|
sleep ${time_to_full_interval}
|
||||||
else
|
else
|
||||||
g_echo_note "NEXT FULL LOOP - ${INTERVAL} seconds in ${time_to_full_interval} seconds"
|
|
||||||
FULL_LOOP=0
|
FULL_LOOP=0
|
||||||
|
sleep ${time_to_interval}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user