From 749261c14632a8b847535ec99b97777c7c3495a5 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 2 Nov 2022 10:17:27 +0700 Subject: [PATCH] take snapshot at 12 localtime --- tubearchivist/home/src/es/snapshot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tubearchivist/home/src/es/snapshot.py b/tubearchivist/home/src/es/snapshot.py index 35ce12c2..b665ba27 100644 --- a/tubearchivist/home/src/es/snapshot.py +++ b/tubearchivist/home/src/es/snapshot.py @@ -107,8 +107,11 @@ class ElasticSnapshot: def _build_policy_data(self): """build policy dict from config""" + at_12 = datetime.now().replace(hour=12, minute=0, second=0) + hour = at_12.astimezone(ZoneInfo("UTC")).hour + return { - "schedule": "0 30 1 * * ?", + "schedule": f"0 0 {hour} * * ?", "name": f"<{self.POLICY}_>", "repository": self.REPO, "config": {