Skip to content

Commit

Permalink
feat: 🎸 allow "post-messages" action (#1861)
Browse files Browse the repository at this point in the history
I removed the allowlist, because it requires to modify the code at two
places, which is error prone (at least, I had the issue).
  • Loading branch information
severo authored Sep 26, 2023
1 parent b83abcd commit 7654067
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jobs/cache_maintenance/src/cache_maintenance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@
def run_job() -> None:
job_config = JobConfig.from_env()
action = job_config.action
supported_actions = ["backfill", "collect-cache-metrics", "collect-queue-metrics", "delete-indexes", "skip"]
# In the future we will support other kind of actions
if not action:
logging.warning("No action mode was selected, skipping tasks.")
return
if action not in supported_actions:
logging.warning(f"Wrong action mode selected, supported actions are {supported_actions}.")
return

init_logging(level=job_config.log.level)
with (
Expand Down Expand Up @@ -75,6 +71,10 @@ def run_job() -> None:
bot_token=job_config.discussions.bot_token,
parquet_revision=job_config.discussions.parquet_revision,
)
elif action == "skip":
pass
else:
logging.warning(f"Action '{action}' is not supported.")

end_time = datetime.now()
logging.info(f"Duration: {end_time - start_time}")
Expand Down

0 comments on commit 7654067

Please sign in to comment.