Skip to content

Commit 789ebb8

Browse files
Added fallback to db call for timeout duration
1 parent 955320d commit 789ebb8

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

CONTRIBUTORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CONTRIBUTORS
22

33
This file is automatically generated. DO NOT EDIT MANUALLY.
4-
Generated on: 2025-09-02T13:37:40.355058Z
4+
Generated on: 2025-09-02T13:44:20.914655Z
55

66
Upstream project: https://github.com/janeczku/calibre-web
77
Fork project (Calibre-Web Automated, since 2024): https://github.com/crocodilestick/calibre-web-automated

root/etc/s6-overlay/s6-rc.d/cwa-ingest-service/run

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,24 @@ mkdir -p "/config/processed_books/failed" 2>/dev/null || true
1919
# Function to get timeout from database
2020
get_timeout_from_db() {
2121
local timeout_minutes
22-
timeout_minutes=$(sqlite3 /config/cwa.db "SELECT ingest_timeout_minutes FROM cwa_settings LIMIT 1;" 2>/dev/null || echo "15")
22+
# Try sqlite3 first, fallback to Python if not available
23+
if command -v sqlite3 >/dev/null 2>&1; then
24+
timeout_minutes=$(sqlite3 /config/cwa.db "SELECT ingest_timeout_minutes FROM cwa_settings LIMIT 1;" 2>/dev/null || echo "15")
25+
else
26+
# Fallback to Python
27+
timeout_minutes=$(python3 -c "
28+
import sqlite3
29+
try:
30+
conn = sqlite3.connect('/config/cwa.db')
31+
cursor = conn.cursor()
32+
cursor.execute('SELECT ingest_timeout_minutes FROM cwa_settings LIMIT 1')
33+
result = cursor.fetchone()
34+
conn.close()
35+
print(result[0] if result else 15)
36+
except:
37+
print(15)
38+
" 2>/dev/null || echo "15")
39+
fi
2340
echo $((timeout_minutes * 60)) # Convert to seconds
2441
}
2542

0 commit comments

Comments
 (0)