Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,12 @@ pub trait RowSource: Send + Sync {

/// Health check: credentials resolve and the provider answers.
fn probe(&self) -> BoxFuture<'_, Result<()>>;

/// Stop what the source runs between ticks and wait for it to finish.
/// Its driver calls this when it stops, possibly more than once.
fn stop(&self) -> BoxFuture<'_, ()> {
Box::pin(std::future::ready(()))
}
}

#[cfg(test)]
Expand Down
11 changes: 7 additions & 4 deletions crates/fetcher/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,14 @@ impl Driver {
/// Stop what the shape runs in the background and wait for it to finish.
///
/// A file tailer writes its final checkpoint, including the last
/// acknowledged tick, which only the driver's checkpoint store holds.
/// Every other shape runs nothing between ticks. Safe to call again.
/// acknowledged tick, which only the driver's checkpoint store holds. A
/// custom shape runs its own [`RowSource::stop`], and a REST or database
/// shape runs nothing between ticks. Safe to call again.
pub async fn stop(&self) {
let Shape::File(shape) = &self.shape else {
return;
let shape = match &self.shape {
Shape::File(shape) => shape,
Shape::Custom(source) => return source.stop().await,
Shape::Rest(_) | Shape::Db(_) => return,
};
let mut committed = HashMap::new();
for unit in shape.units() {
Expand Down
Loading
Loading