Skip to content

Commit

Permalink
only update config if it actually changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Dec 25, 2023
1 parent 5289f4d commit 1c73929
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,17 +432,23 @@ def asset_to_tiles(asset):
for setup_id in app.config["SETUP_IDS"]:
config = ib.get(f"setup/{setup_id}")["config"][""]

old_config = config.copy()

for schedule in config["schedules"]:
if schedule["name"] == "User Content":
log.info('Found schedule "User Content" in setup {}'.format(setup_id))

schedule["pages"] = pages

ib.post(
f"setup/{setup_id}",
config=tojson({"": config}),
mode="update",
)
if old_config != config:
log.info("[Setup {}] Config has changed, updating".format(setup_id))
ib.post(
f"setup/{setup_id}",
config=tojson({"": config}),
mode="update",
)
else:
log.info("[Setup {}] Config has not changed, skipping update".format(setup_id))

r.set("last-sync", int(time.time()))
log.info("updated everything")
Expand Down

0 comments on commit 1c73929

Please sign in to comment.