From c2694ed556dd6d78724797be5159c6f27843f4b3 Mon Sep 17 00:00:00 2001 From: Kevin Reynolds Date: Wed, 21 Aug 2024 14:54:39 -0400 Subject: [PATCH] better persistence --- base/app/app.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/base/app/app.py b/base/app/app.py index 82fd9b4..617e933 100644 --- a/base/app/app.py +++ b/base/app/app.py @@ -230,14 +230,23 @@ def send_sqs(meta: dict, kill: bool=False) -> dict|None: def main(): """ Main Function - """ + """ metadata = query_metadata() labInfo = get_lab_info(metadata) sqsMeta = build_sqs_meta(metadata, labInfo) - petName = load_state("petname") - if not petName: + first_deploy = False + deploy = load_state("depID") + if deploy != metadata["depID"]: + first_deploy = True + save_state("depID", metadata["depID"]) + + if first_deploy: petName = generate_petname() + else: + petName = load_state("petname") + if not petName: + petName = generate_petname() app = Flask(__name__)