async def _get_active_syncs_with_schedule(self, db: AsyncSession) -> list[schemas.Sync]:
        """Get all active syncs with cron schedules that are due to run."""
        now = datetime.now(timezone.utc)
        logger.debug(f"Querying for active syncs with schedules at {now.isoformat()}")

        # First, get syncs with next_scheduled_run in the past or null
        query_start = datetime.now(timezone.utc)
        syncs = await crud.sync.get_all_with_schedule(db)
        query_duration = (datetime.now(timezone.utc) - query_start).total_seconds()

        sync_list = [schemas.SyncWithoutConnections.model_validate(sync) for sync in syncs]
        logger.debug(f"Found {len(sync_list)} candidate syncs in {query_duration:.3f}s")

        # Log some details about the syncs
        if sync_list:
            sync_details = ", ".join([f"{s.id} ({s.name})" for s in sync_list[:5]])
            if len(sync_list) > 5:
                sync_details += f", and {len(sync_list) - 5} more"
            logger.debug(f"Candidate syncs: {sync_details}")

        return sync_list
Get all active syncs with cron schedules that are due to run.
backend/airweave/platform/scheduler.py