From 7594336171404f9219b65bb439b19ba7bb8ac7d7 Mon Sep 17 00:00:00 2001 From: Ayo Date: Tue, 14 Apr 2026 09:02:21 +0200 Subject: [PATCH] feat(notes): retry sync only 5 times --- functions.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/functions.sh b/functions.sh index a219a1f..77bfeaf 100644 --- a/functions.sh +++ b/functions.sh @@ -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,8 +25,14 @@ notesSync() { } else echo ">>> Sync skipped due to timeout ($time)" - echo "retrying..." - notesSync + retries=$(($retries + 1)) + echo "retrying ($retries/$max_retries)..." + if [ $retries -eq $max_retries ]; then + return + else + notesSync + fi + fi }