Skip to content

Commit

Permalink
Fix auto-update to restart immediately on startup
Browse files Browse the repository at this point in the history
When `startup=True`, the script will not wait for 5 AM to restart after an update.
  • Loading branch information
Lenochxd committed Nov 8, 2024
1 parent 7d4c002 commit 8df7a77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Change directory to the main.py dir
os.chdir(os.path.dirname(os.path.abspath(__file__)))

updater.auto_update()
updater.auto_update(startup=True)

def load_config():
with open('config.yml', 'r') as config_file:
Expand Down
4 changes: 2 additions & 2 deletions updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def update_to_latest_release(tag_name):
set_installed_version(tag_name)

# Main updater logic
def auto_update():
def auto_update(startup=False):
repo = config.get('update-source')

# Get the latest release
Expand All @@ -153,7 +153,7 @@ def auto_update():
if check_build_status(repo, last_commit_sha):
print(f"Build successful. Updating to {release_tag}.")
update_to_latest_release(release_tag)
if __name__ != "__main__":
if __name__ != "__main__" and not startup:
restart_script()
else:
print("Build failed or not successful. Update aborted.")
Expand Down

0 comments on commit 8df7a77

Please sign in to comment.