mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
Fix potential infinite loop when waiting for a configuration from the autoconf
This commit is contained in:
parent
95c796c1ee
commit
f7d9af9d69
2 changed files with 21 additions and 22 deletions
|
@ -262,17 +262,26 @@ if __name__ == "__main__":
|
|||
"DATABASE_URI", getenv("DATABASE_URI", None)
|
||||
),
|
||||
)
|
||||
env = {}
|
||||
|
||||
if INTEGRATION in (
|
||||
"Swarm",
|
||||
"Kubernetes",
|
||||
"Autoconf",
|
||||
):
|
||||
while not db.is_initialized():
|
||||
logger.warning(
|
||||
"Database is not initialized, retrying in 5s ...",
|
||||
)
|
||||
sleep(5)
|
||||
|
||||
while not db.is_autoconf_loaded():
|
||||
logger.warning(
|
||||
"Autoconf is not loaded yet in the database, retrying in 5s ...",
|
||||
)
|
||||
sleep(5)
|
||||
|
||||
env = db.get_config()
|
||||
elif (
|
||||
not tmp_variables_path.exists()
|
||||
or not nginx_variables_path.exists()
|
||||
|
@ -301,21 +310,21 @@ if __name__ == "__main__":
|
|||
"Config saver failed, configuration will not work as expected...",
|
||||
)
|
||||
|
||||
while not db.is_initialized():
|
||||
logger.warning(
|
||||
"Database is not initialized, retrying in 5s ...",
|
||||
)
|
||||
sleep(5)
|
||||
while not db.is_initialized():
|
||||
logger.warning(
|
||||
"Database is not initialized, retrying in 5s ...",
|
||||
)
|
||||
sleep(5)
|
||||
|
||||
env = db.get_config()
|
||||
while not db.is_first_config_saved() or not env:
|
||||
logger.warning(
|
||||
"Database doesn't have any config saved yet, retrying in 5s ...",
|
||||
)
|
||||
sleep(5)
|
||||
env = db.get_config()
|
||||
while not db.is_first_config_saved() or not env:
|
||||
logger.warning(
|
||||
"Database doesn't have any config saved yet, retrying in 5s ...",
|
||||
)
|
||||
sleep(5)
|
||||
env = db.get_config()
|
||||
|
||||
env["DATABASE_URI"] = db.database_uri
|
||||
env["DATABASE_URI"] = db.database_uri
|
||||
|
||||
# Instantiate scheduler
|
||||
SCHEDULER = JobScheduler(env.copy() | environ.copy(), logger, INTEGRATION)
|
||||
|
|
|
@ -205,16 +205,6 @@ while not db.is_initialized():
|
|||
)
|
||||
sleep(5)
|
||||
|
||||
env = db.get_config()
|
||||
while not db.is_first_config_saved() or not env:
|
||||
app.logger.warning(
|
||||
"Database doesn't have any config saved yet, retrying in 5s ...",
|
||||
)
|
||||
sleep(5)
|
||||
env = db.get_config()
|
||||
|
||||
del env
|
||||
|
||||
app.logger.info("Database is ready")
|
||||
Path(sep, "var", "tmp", "bunkerweb", "ui.healthy").write_text("ok", encoding="utf-8")
|
||||
bw_version = (
|
||||
|
|
Loading…
Reference in a new issue