feat(notes): retry sync only 5 times

This commit is contained in:
ayo 2026-04-14 09:02:21 +02:00
parent 88a154f077
commit 7594336171

View file

@ -2,12 +2,14 @@
bold=$(tput bold)
dlob=$(tput sgr0)
retries=0
# Sync notes via git
notesSync() {
# check if online
test="git.sr.ht"
time="0.5"
max_retries=5
if timeout $time ping -q -c 1 -W 1 $test >/dev/null; then
{
path="${notes_dir}/"
@ -23,9 +25,15 @@ notesSync() {
}
else
echo ">>> Sync skipped due to timeout ($time)"
echo "retrying..."
retries=$(($retries + 1))
echo "retrying ($retries/$max_retries)..."
if [ $retries -eq $max_retries ]; then
return
else
notesSync
fi
fi
}