Skip to content

Commit

Permalink
Revert download to .tmp in frontend_management (#5369)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Oct 25, 2024
1 parent 5281090 commit ce759b7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions app/frontend_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,16 @@ def init_frontend_unsafe(cls, version_string: str, provider: Optional[FrontEndPr
Path(cls.CUSTOM_FRONTENDS_ROOT) / provider.folder_name / semantic_version
)
if not os.path.exists(web_root):
# Use tmp path until complete to avoid path exists check passing from interrupted downloads
tmp_path = web_root + ".tmp"
try:
os.makedirs(tmp_path, exist_ok=True)
os.makedirs(web_root, exist_ok=True)
logging.info(
"Downloading frontend(%s) version(%s) to (%s)",
provider.folder_name,
semantic_version,
tmp_path,
web_root,
)
logging.debug(release)
download_release_asset_zip(release, destination_path=tmp_path)
if os.listdir(tmp_path):
os.rename(tmp_path, web_root)
download_release_asset_zip(release, destination_path=web_root)
finally:
# Clean up the directory if it is empty, i.e. the download failed
if not os.listdir(web_root):
Expand Down

0 comments on commit ce759b7

Please sign in to comment.