diff --git a/models.py b/models.py index 8822b79..f606d21 100644 --- a/models.py +++ b/models.py @@ -14,6 +14,8 @@ class Repo(peewee.Model): ('other_than_working', 'Other than working'), ), default="other_than_working") + random_job_day = peewee.IntegerFieldIntegerField(null=True) + class Meta: database = db diff --git a/run.py b/run.py index 6cd86b6..e0deb8b 100644 --- a/run.py +++ b/run.py @@ -179,6 +179,10 @@ async def monitor_apps_lists(type="stable"): repo.state = repo_state repo.save() + if repo.random_job_day is None: + repo.random_job_day = randint(1, 28) + repo.save() + # new app else: task_logger.info(f"New application detected: {app_id} in {app_list_name}, scheduling a new job") @@ -188,6 +192,7 @@ async def monitor_apps_lists(type="stable"): revision=commit_sha, app_list=app_list_name, state="working" if app_data["state"] in ("working", "validated") else "other_than_working", + random_job_day=randint(1, 28), ) await create_job(app_id, app_list_name, repo, job_command_last_part)