Remove old Resos sync path (resos_bookings table)

Consolidates to single sync path: resos_bookings_sync.py →
resos_bookings_data table. Removes sync_resos_data(), duplicate
load_resos_custom_field_mappings(), resos_api_key and
sync_resos_enabled seed rows, and the dead resos_sync scheduler job.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-13 21:07:47 +00:00
parent 1a0b18f06e
commit fc15bc5d9a
3 changed files with 14 additions and 273 deletions

View file

@ -8,7 +8,6 @@ from sqlalchemy import text
from jobs.data_sync import (
sync_newbook_data,
sync_resos_data,
sync_newbook_occupancy_report,
sync_newbook_earned_revenue
)
@ -23,6 +22,7 @@ from jobs.weekly_forecast_snapshot import run_weekly_forecast_snapshot
from jobs.fetch_current_rates import run_fetch_current_rates
from jobs.scrape_booking_rates import run_scheduled_booking_scrape_async
from jobs.ai_insights import run_ai_insights_generation
from jobs.weather_sync import run_weather_sync
from database import SyncSessionLocal
logger = logging.getLogger(__name__)
@ -108,15 +108,6 @@ async def run_scheduled_resos_bookings_sync():
logger.info("Scheduled Resos bookings sync skipped (disabled in settings)")
async def run_scheduled_resos_sync():
"""Wrapper to check if Resos sync is enabled before running"""
if is_sync_enabled("resos"):
logger.info("Running scheduled Resos sync")
await sync_resos_data(triggered_by="scheduler")
else:
logger.info("Scheduled Resos sync skipped (disabled in settings)")
async def run_scheduled_occupancy_report_sync():
"""Wrapper to run occupancy report sync (uses dedicated occupancy enabled flag)"""
from datetime import date, timedelta
@ -181,21 +172,6 @@ def reschedule_sync_jobs():
)
logger.info(f" Resos bookings sync scheduled for {rsb_hour:02d}:{rsb_min:02d}")
# Resos sync - uses general sync_schedule_time for now
rs_time = get_config_value("sync_schedule_time", "05:05")
try:
rs_hour, rs_min = int(rs_time.split(':')[0]), int(rs_time.split(':')[1])
except:
rs_hour, rs_min = 5, 5
scheduler.add_job(
run_scheduled_resos_sync,
CronTrigger(hour=rs_hour, minute=rs_min),
id="resos_sync",
name=f"Daily Resos Sync ({rs_hour:02d}:{rs_min:02d})",
replace_existing=True
)
logger.info(f" Resos sync scheduled for {rs_hour:02d}:{rs_min:02d}")
# Newbook occupancy report
occ_hour, occ_min = get_sync_time("newbook_occupancy", 5, 8)
scheduler.add_job(
@ -356,6 +332,17 @@ def start_scheduler():
)
logger.info(f" AI Insights scheduled for {ai_hour:02d}:{ai_min:02d}")
# Weather sync - Daily at 05:15 (last 7 days, catches ERA5 corrections)
wx_hour, wx_min = get_sync_time("weather", 5, 15)
scheduler.add_job(
run_weather_sync,
CronTrigger(hour=wx_hour, minute=wx_min),
id="weather_sync",
name=f"Daily Weather Sync ({wx_hour:02d}:{wx_min:02d})",
replace_existing=True
)
logger.info(f" Weather sync scheduled for {wx_hour:02d}:{wx_min:02d}")
scheduler.start()
logger.info("Scheduler started successfully")