mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 02:22:44 +01:00
Merge upstream master into claude/rq-scan-queue-split
Master landed #4274 with the review changes that came out of it, and those moved the code this branch was built on. Scan job bookkeeping now lives in `handler/scan_jobs.py`, every enqueue goes through `enqueue_task`, cron entries carry their own name and result TTL, and the watcher builds its two rescans from one helper. Resolved by putting this branch's changes where that code now lives: - The scan queue, the scoped-scan check and the second scheduled registry moved into `handler/scan_jobs.py`, keeping master's single-round-trip reads (`get_job_ids` plus one `fetch_many`, and `get_jobs_to_schedule` for the stale sweep) across both registries. - `enqueue_scheduled_scan` sits next to `enqueue_task` in the registry and is built from it, rather than hand-rolling the same enqueue in `tasks/tasks.py`. Its tests moved with it. - Cron keeps master's per-entry name and result TTL, and adds the scan dispatch on top: `TASK_TIMEOUT` for the dispatch, the task's own timeout (now `SCAN_TIMEOUT`) for the scan it enqueues. - The watcher's `schedule_rescan` helper enqueues on the scan queue with the abandoned-job callback. - `PeriodicTask.func` is gone from master, so the scheduled rescan declares only its timeout. `tasks.registry.enqueue_scheduled_scan` joins the func paths an RQ worker has to be able to import. - The job stubs shared by the discovery tests grew the scan queue and a scoped-scan job; the duplicated stale-sweep tests are master's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -221,30 +221,24 @@ start_bin_valkey-server() {
|
||||
error_log "Internal valkey did not become ready after $((max_retries * 500))ms"
|
||||
}
|
||||
|
||||
# The app reads REDIS_SSL as a boolean, so "false" and "0" mean plaintext.
|
||||
# Testing the variable for non-emptiness would make every documented value TLS.
|
||||
redis_scheme() {
|
||||
local ssl
|
||||
ssl="$(printf '%s' "${REDIS_SSL-}" | tr '[:upper:]' '[:lower:]')"
|
||||
case "${ssl}" in
|
||||
1 | true | yes | on) echo "rediss" ;;
|
||||
*) echo "redis" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# The URL carries the password, so it goes through RQ_REDIS_URL rather than
|
||||
# --url, which would put it on a world-readable command line.
|
||||
# --url, which would put it on a world-readable command line. REDIS_SSL is a
|
||||
# boolean to the app, so "false" and "0" mean plaintext.
|
||||
build_redis_url() {
|
||||
local scheme
|
||||
scheme="$(redis_scheme)"
|
||||
local scheme userinfo="" ssl="${REDIS_SSL-}"
|
||||
|
||||
case "${ssl,,}" in
|
||||
1 | true | yes | on) scheme="rediss" ;;
|
||||
*) scheme="redis" ;;
|
||||
esac
|
||||
|
||||
if [[ -n ${REDIS_PASSWORD-} ]]; then
|
||||
echo "${scheme}://${REDIS_USERNAME-}:${REDIS_PASSWORD}@${REDIS_HOST:-127.0.0.1}:${REDIS_PORT:-6379}/${REDIS_DB:-0}"
|
||||
userinfo="${REDIS_USERNAME-}:${REDIS_PASSWORD}@"
|
||||
elif [[ -n ${REDIS_USERNAME-} ]]; then
|
||||
echo "${scheme}://${REDIS_USERNAME}@${REDIS_HOST:-127.0.0.1}:${REDIS_PORT:-6379}/${REDIS_DB:-0}"
|
||||
else
|
||||
echo "${scheme}://${REDIS_HOST:-127.0.0.1}:${REDIS_PORT:-6379}/${REDIS_DB:-0}"
|
||||
userinfo="${REDIS_USERNAME}@"
|
||||
fi
|
||||
|
||||
echo "${scheme}://${userinfo}${REDIS_HOST:-127.0.0.1}:${REDIS_PORT:-6379}/${REDIS_DB:-0}"
|
||||
}
|
||||
|
||||
# Commands to start the RQ cron scheduler, which runs the periodic tasks listed
|
||||
|
||||
Reference in New Issue
Block a user