Badal commited on
Commit ·
c477021
1
Parent(s): 6c5f0a6
Fix: Add timeout + error handling to prevent sync hanging
Browse files- Dockerfile +1 -0
- entrypoint.sh +10 -7
Dockerfile
CHANGED
|
@@ -18,6 +18,7 @@ RUN apt-get update && apt-get install -y \
|
|
| 18 |
zip \
|
| 19 |
unzip \
|
| 20 |
procps \
|
|
|
|
| 21 |
&& curl -LsSf https://hf.co/cli/install.sh | bash \
|
| 22 |
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
|
|
|
|
| 18 |
zip \
|
| 19 |
unzip \
|
| 20 |
procps \
|
| 21 |
+
timeout \
|
| 22 |
&& curl -LsSf https://hf.co/cli/install.sh | bash \
|
| 23 |
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
|
entrypoint.sh
CHANGED
|
@@ -39,7 +39,7 @@ sleep 10
|
|
| 39 |
echo '=== [STEP 2] OPENCODE STARTED ==='
|
| 40 |
|
| 41 |
# ============================================
|
| 42 |
-
# STEP 3: REAL-TIME CONTINUOUS SYNC
|
| 43 |
# ============================================
|
| 44 |
echo '=== [STEP 3] STARTING REAL-TIME SYNC ==='
|
| 45 |
while true; do
|
|
@@ -49,10 +49,13 @@ while true; do
|
|
| 49 |
exit 1
|
| 50 |
fi
|
| 51 |
|
| 52 |
-
#
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
| 58 |
done
|
|
|
|
| 39 |
echo '=== [STEP 2] OPENCODE STARTED ==='
|
| 40 |
|
| 41 |
# ============================================
|
| 42 |
+
# STEP 3: REAL-TIME CONTINUOUS SYNC (with timeout + error handling)
|
| 43 |
# ============================================
|
| 44 |
echo '=== [STEP 3] STARTING REAL-TIME SYNC ==='
|
| 45 |
while true; do
|
|
|
|
| 49 |
exit 1
|
| 50 |
fi
|
| 51 |
|
| 52 |
+
# Sync with 30 sec timeout to prevent hanging
|
| 53 |
+
timeout 30 hf sync "$SOURCE" "$BUCKET" --delete --quiet
|
| 54 |
+
|
| 55 |
+
# If sync fails or times out, log it but continue
|
| 56 |
+
if [ $? -ne 0 ]; then
|
| 57 |
+
echo "WARNING: Sync issue at $(date) - continuing..."
|
| 58 |
+
fi
|
| 59 |
+
|
| 60 |
+
sleep 2
|
| 61 |
done
|