Skip to content

Commit

Permalink
janitor: fix update scheduling
Browse files Browse the repository at this point in the history
A timeout of a minute is to short, increase it to 10 minute. Also add
the `--with-scheduler` argument to the workers so they actually pickup
jobs. This somehow worked locally without the argument...

Signed-off-by: Paul Spooren <mail@aparcar.org>
  • Loading branch information
aparcar committed Nov 30, 2023
1 parent c007d12 commit 26239df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
25 changes: 14 additions & 11 deletions asu/janitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,22 +218,25 @@ def update(config):
downloaded and stored in the Redis database.
"""

if not config["BRANCHES"]:
logging.error("No BRANCHES defined in config, nothing to do, exiting")
return
for branch in config["BRANCHES"].values():
if not branch.get("enabled"):
logging.info(f"{branch['name']}: Skip disabled branch")
continue
try:
if not config["BRANCHES"]:
logging.error("No BRANCHES defined in config, nothing to do, exiting")
return
for branch in config["BRANCHES"].values():
if not branch.get("enabled"):
logging.info(f"{branch['name']}: Skip disabled branch")
continue

logging.info(f"Update {branch['name']}")
update_branch(config, branch)
logging.info(f"Update {branch['name']}")
update_branch(config, branch)

update_meta_json(config)
update_meta_json(config)
except Exception:
logging.exception("Failed to update")

Queue(connection=get_redis_client(config)).enqueue_in(
timedelta(minutes=10),
update,
config,
job_timeout="1m",
job_timeout="10m",
)
4 changes: 2 additions & 2 deletions podman-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
context: ./
dockerfile: Containerfile
restart: always
command: rqworker
command: rqworker --with-scheduler
environment:
- CONTAINER_HOST=unix://$CONTAINER_SOCK
- REDIS_URL=redis://redis/
Expand All @@ -41,7 +41,7 @@ services:
context: ./
dockerfile: Containerfile
restart: always
command: rqworker
command: rqworker --with-scheduler
environment:
- CONTAINER_HOST=unix://$CONTAINER_SOCK
- REDIS_URL=redis://redis/
Expand Down

0 comments on commit 26239df

Please sign in to comment.