Skip to content

Commit

Permalink
chore: Ignore plugins with not changed checksum during generation in …
Browse files Browse the repository at this point in the history
…scheduler
  • Loading branch information
TheophileDiot committed May 22, 2024
1 parent c0eeaab commit e99937f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/scheduler/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def generate_external_plugins(plugins: List[Dict[str, Any]], *, original_path: U

# Remove old external/pro plugins files
logger.info(f"Removing old/changed {'pro ' if pro else ''}external plugins files ...")
ignored_plugins = set()
if original_path.is_dir():
for file in original_path.glob("*"):
try:
Expand All @@ -187,6 +188,7 @@ def generate_external_plugins(plugins: List[Dict[str, Any]], *, original_path: U
tar.add(file, arcname=file.name, recursive=True)
plugin_content.seek(0, 0)
if bytes_hash(plugin_content, algorithm="sha256") == plugins[index]["checksum"]:
ignored_plugins.add(file.name)
continue
logger.debug(f"Checksum of {file} has changed, removing it ...")

Expand All @@ -200,6 +202,9 @@ def generate_external_plugins(plugins: List[Dict[str, Any]], *, original_path: U
logger.info(f"Generating new {'pro ' if pro else ''}external plugins ...")
original_path.mkdir(parents=True, exist_ok=True)
for plugin in plugins:
if plugin["id"] in ignored_plugins:
continue

try:
if plugin["data"]:
tmp_path = TMP_PATH.joinpath(f"{plugin['id']}_{plugin['name']}.tar.gz")
Expand Down

0 comments on commit e99937f

Please sign in to comment.