use crate::batch_plan::main::window_concurrency::window_concurrency;
use crate::loader::models::{CommitRule, TablePlan};
pub fn ignored_concurrency(plan: &TablePlan) -> Option<String> {
if plan
.spec
.batch_concurrency
.is_none_or(|limit| limit.get() <= 1)
|| window_concurrency(plan) > 1
{
return None;
}
let reason = match &plan.commits {
CommitRule::Windows(windows) if windows.count <= 1 => return None,
CommitRule::Windows(_) => "only a Postgres source reads windows at once",
_ => "the table commits no batch_size windows",
};
Some(format!("batch_concurrency is ignored: {reason}"))
}