mirror of
https://github.com/skoelle/icloud-contacts-sync.git
synced 2026-09-17 23:40:24 +00:00
timezone config fix
This commit is contained in:
+5
-5
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user