Skip to content

Commit ad7061f

Browse files
committed
fix(start): simplify startup check
- use the same condition for probing and reporting - use cache.get instead of in for testing as that is easier to read
1 parent a755807 commit ad7061f

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

start

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,14 @@ wait_for_shell_dependency() {
258258
local failure_label=$2
259259
local dependency_location=$3
260260
local dependency_check=$4
261-
local dependency_failure_check=$5
262261
local max_retries=30
263262
local timeout=0
264263

265264
until run_weblate shell -c "$dependency_check" > /dev/null; do
266265
>&2 echo "$wait_label at $dependency_location is unavailable - retrying $((max_retries - timeout))"
267266
((timeout += 1))
268267
if ((timeout > max_retries)); then
269-
run_weblate shell -c "$dependency_failure_check"
268+
run_weblate shell -c "$dependency_check"
270269
fail_dep "$failure_label"
271270
fi
272271
sleep 1
@@ -278,8 +277,7 @@ wait_for_redis() {
278277
redis \
279278
redis \
280279
"${REDIS_HOST:-cache}" \
281-
'from django.core.cache import cache; "ping" in cache' \
282-
'from django.core.cache import cache; "ping" in cache'
280+
'from django.core.cache import cache; cache.get("ping")'
283281
}
284282

285283
set_postgres_connection_defaults() {
@@ -294,8 +292,7 @@ wait_for_database() {
294292
"Database server" \
295293
PostgreSQL \
296294
"${POSTGRES_HOST:-db}" \
297-
'from weblate.auth.models import User; User.objects.raw("SELECT 1")' \
298-
'from weblate.auth.models import User; User.objects.exists()'
295+
'from weblate.auth.models import User; User.objects.raw("SELECT 1")'
299296
}
300297

301298
database_version_check_enabled() {

0 commit comments

Comments
 (0)