timezone config fix

This commit is contained in:
2026-08-07 13:18:33 +02:00
parent d458c58c64
commit 5cdefff6f5
4 changed files with 17 additions and 17 deletions
+5 -5
View File
@@ -19,7 +19,7 @@ import time
from datetime import datetime, timedelta
import db
from config import TIMEZONE
from config import Config
logging.basicConfig(
level=os.environ.get("LOG_LEVEL", "INFO"),
@@ -63,7 +63,7 @@ def run_sync():
run_script("Sync", "/app/sync.py")
try:
with open("/tmp/last_sync_ok", "w") as f:
f.write(datetime.now(TIMEZONE).isoformat())
f.write(datetime.now(Config.TIMEZONE).isoformat())
except OSError:
pass
@@ -75,7 +75,7 @@ def run_mailer():
def next_run_time(hour: int) -> datetime:
now = datetime.now(TIMEZONE)
now = datetime.now(Config.TIMEZONE)
target = now.replace(hour=hour, minute=0, second=0, microsecond=0)
if target <= now:
target += timedelta(days=1)
@@ -104,11 +104,11 @@ def main():
logger.info("Starte ersten Sync-Lauf...")
run_sync()
last_sync = datetime.now(TIMEZONE)
last_sync = datetime.now(Config.TIMEZONE)
next_mailer = next_run_time(MAIL_SEND_HOUR)
while not _shutdown:
now = datetime.now(TIMEZONE)
now = datetime.now(Config.TIMEZONE)
if now >= last_sync + timedelta(minutes=SYNC_INTERVAL_MINUTES):
run_sync()