Skip to content

Commit

Permalink
Update the management of legacy*.json
Browse files Browse the repository at this point in the history
  • Loading branch information
huangwb8 committed Jun 6, 2023
1 parent 3ac72a1 commit 8797340
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions myblog.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ async def main():
break
except Exception as e:
print("OOPS, the REST API mode failed!")
os.remove(path_legacy_json)
os.rename(
path_legacy_json + "_temporary-copy", path_legacy_json
)
if os.path.exists(path_legacy_json + "_temporary-copy"):
os.remove(path_legacy_json)
os.rename(
path_legacy_json + "_temporary-copy", path_legacy_json
)
if retry < max_retries - 1:
print("Retrying...")
continue
Expand Down Expand Up @@ -157,10 +158,11 @@ async def main():
break
except Exception as e:
print("OOPS, the Password mode failed!")
os.remove(path_legacy_json)
os.rename(
path_legacy_json + "_temporary-copy", path_legacy_json
)
if os.path.exists(path_legacy_json + "_temporary-copy"):
os.remove(path_legacy_json)
os.rename(
path_legacy_json + "_temporary-copy", path_legacy_json
)
if retry < max_retries - 1:
print("Retrying...")
continue
Expand Down

0 comments on commit 8797340

Please sign in to comment.