pub fn spawn_sync_loop<C, O>(
engine: Arc<CdcSyncEngine<C, O>>,
interval: Duration,
cancel: CancellationToken,
ddl_lock: Arc<RwLock<()>>,
) -> JoinHandle<()>Expand description
Spawn a background task that continuously polls CDC and syncs to OLAP.
The loop runs sync_once() on the given interval, logging results and errors.
It shuts down gracefully when the CancellationToken is cancelled.
The ddl_lock is acquired as a read lock before each cycle to prevent
interleaving with schema changes (which take a write lock).
ยงReturns
A JoinHandle for the background task. The caller retains the
CancellationToken and is responsible for cancelling it to stop the loop.