Skip to content

Commit

Permalink
sleep to let other machines reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Sep 26, 2024
1 parent 4a12450 commit e19966c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import subprocess
import tempfile
from pathlib import Path
from time import sleep
from typing import Any

from flask import abort
Expand Down Expand Up @@ -159,6 +160,10 @@ def update_app_and_ui() -> ResponseReturnValue:
def reboot() -> ResponseReturnValue:
"""Reboots unit"""
# TODO: only let requests from the leader do this. Use lighttpd conf for this.

# don't reboot the leader right away, give time for any other posts/gets to occur.
if HOSTNAME == get_leader_hostname():
sleep(5)
task = tasks.reboot()
return create_task_response(task)

Expand Down

0 comments on commit e19966c

Please sign in to comment.