Ver Fonte

Enable remote sync periodics; lazify user_cal import in diff

- workflows/remote.py: uncomment register_periodic calls for short (6h)
  and long (daily) remote sync horizons
- actions/diff.py: move UserCal import inside _diff_user_cal_closed so
  diff loads cleanly when user_cal is not available (module refactor pre-work)
ZiB há 4 meses atrás
pai
commit
98449efdce
2 ficheiros alterados com 3 adições e 4 exclusões
  1. 1 1
      room_cal/actions/diff.py
  2. 2 3
      room_cal/workflows/remote.py

+ 1 - 1
room_cal/actions/diff.py

@@ -8,7 +8,6 @@ from room_cal.closed import Closed
 from room_cal.discount import Discount
 from room_cal.pricing.price_calendar import CalPrice
 from room_cal.reservations import Reservation
-from room_cal.user_cal import UserCal
 from room_cal._utils import (
   safe_json_loads, iter_dates, filter_events, services as _services,
   get_config, event_dates, registered_domains, local_today,
@@ -312,6 +311,7 @@ async def _diff_user_cal_closed(
 
   Each row: {'date', 'in_room': bool, 'in_user_cal': bool}
   """
+  from room_cal.user_cal import UserCal
   closed_cal = Closed()
   user_cal = UserCal()
 

+ 2 - 3
room_cal/workflows/remote.py

@@ -21,6 +21,5 @@ async def _periodic_remote_sync_long(api: 'ServiceAPI') -> None:
   await remote_sync(start, start + timedelta(days=window), api=api)
 
 
-# TODO: enable once remote-sync has been tested in production
-# register_periodic(_periodic_remote_sync_short, timedelta(hours=6))
-# register_periodic(_periodic_remote_sync_long, timedelta(days=1))
+register_periodic(_periodic_remote_sync_short, timedelta(hours=6))
+register_periodic(_periodic_remote_sync_long, timedelta(days=1))