mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
Handle changes more elegantly with the scheduler
This commit is contained in:
parent
0f7df13df3
commit
4ec754143a
1 changed files with 14 additions and 8 deletions
|
@ -470,6 +470,7 @@ if __name__ == "__main__":
|
|||
|
||||
FIRST_RUN = True
|
||||
CONFIG_NEED_GENERATION = True
|
||||
RUN_JOBS_ONCE = True
|
||||
CHANGES = []
|
||||
threads = []
|
||||
|
||||
|
@ -498,6 +499,7 @@ if __name__ == "__main__":
|
|||
)
|
||||
stop(1)
|
||||
|
||||
if RUN_JOBS_ONCE:
|
||||
# Update the environment variables of the scheduler
|
||||
SCHEDULER.env = env.copy() | environ.copy()
|
||||
SCHEDULER.setup()
|
||||
|
@ -613,6 +615,7 @@ if __name__ == "__main__":
|
|||
)
|
||||
|
||||
NEED_RELOAD = False
|
||||
RUN_JOBS_ONCE = False
|
||||
CONFIG_NEED_GENERATION = False
|
||||
CONFIGS_NEED_GENERATION = False
|
||||
PLUGINS_NEED_GENERATION = False
|
||||
|
@ -675,6 +678,7 @@ if __name__ == "__main__":
|
|||
)
|
||||
|
||||
PLUGINS_NEED_GENERATION = True
|
||||
CONFIG_NEED_GENERATION = True
|
||||
NEED_RELOAD = True
|
||||
|
||||
# check if the custom configs have changed since last time
|
||||
|
@ -693,6 +697,7 @@ if __name__ == "__main__":
|
|||
if changes["instances_changed"]:
|
||||
logger.info("Instances changed, generating ...")
|
||||
INSTANCES_NEED_GENERATION = True
|
||||
CONFIG_NEED_GENERATION = True
|
||||
NEED_RELOAD = True
|
||||
|
||||
FIRST_RUN = False
|
||||
|
@ -718,6 +723,7 @@ if __name__ == "__main__":
|
|||
CHANGES.append("config")
|
||||
env = db.get_config()
|
||||
env["DATABASE_URI"] = db.database_uri
|
||||
RUN_JOBS_ONCE = True
|
||||
|
||||
if INSTANCES_NEED_GENERATION:
|
||||
CHANGES.append("instances")
|
||||
|
|
Loading…
Reference in a new issue