Change batch stop reason messages to match the new batch_strategy API name

This commit is contained in:
Louis Dureuil 2025-05-22 12:20:17 +02:00
parent 4d761d3444
commit cf4798bd2b
No known key found for this signature in database

View File

@ -746,70 +746,70 @@ impl Display for BatchStopReason {
match self { match self {
BatchStopReason::Unspecified => f.write_str("unspecified"), BatchStopReason::Unspecified => f.write_str("unspecified"),
BatchStopReason::TaskKindCannotBeBatched { kind } => { BatchStopReason::TaskKindCannotBeBatched { kind } => {
write!(f, "a batch of tasks of type `{kind}` cannot be batched with any other type of task") write!(f, "stopped after the last task of type `{kind}` because they cannot be batched with tasks of any other type.")
} }
BatchStopReason::TaskCannotBeBatched { kind, id } => { BatchStopReason::TaskCannotBeBatched { kind, id } => {
write!(f, "task with id {id} of type `{kind}` cannot be batched") write!(f, "created batch containing only task with id {id} of type `{kind}` that cannot be batched with any other task.")
} }
BatchStopReason::ExhaustedEnqueuedTasks => f.write_str("batched all enqueued tasks"), BatchStopReason::ExhaustedEnqueuedTasks => f.write_str("batched all enqueued tasks"),
BatchStopReason::ExhaustedEnqueuedTasksForIndex { index } => { BatchStopReason::ExhaustedEnqueuedTasksForIndex { index } => {
write!(f, "batched all enqueued tasks for index `{index}`") write!(f, "batched all enqueued tasks for index `{index}`")
} }
BatchStopReason::ReachedTaskLimit { task_limit } => { BatchStopReason::ReachedTaskLimit { task_limit } => {
write!(f, "reached configured batch limit of {task_limit} tasks") write!(f, "batched up to configured batch limit of {task_limit} tasks")
} }
BatchStopReason::ReachedSizeLimit { size_limit, size } => write!( BatchStopReason::ReachedSizeLimit { size_limit, size } => write!(
f, f,
"reached configured batch size limit of {size_limit}B with a total of {size}B" "batched up to configured batch size limit of {size_limit}B with a total of {size}B",
), ),
BatchStopReason::PrimaryKeyIndexMismatch { id, in_index, in_task } => { BatchStopReason::PrimaryKeyIndexMismatch { id, in_index, in_task } => {
write!(f, "primary key `{in_task}` in task with id {id} is different from the primary key of the index `{in_index}`") write!(f, "stopped batching before task with id {id} because its primary key `{in_task}` is different from the primary key of the index `{in_index}`")
} }
BatchStopReason::IndexCreationMismatch { id } => { BatchStopReason::IndexCreationMismatch { id } => {
write!(f, "task with id {id} has different index creation rules as in the batch") write!(f, "stopped batching before task with id {id} because its index creation rules differ from the ones from the batch")
} }
BatchStopReason::PrimaryKeyMismatch { reason, id } => match reason { BatchStopReason::PrimaryKeyMismatch { reason, id } => match reason {
PrimaryKeyMismatchReason::TaskPrimaryKeyDifferFromIndexPrimaryKey { PrimaryKeyMismatchReason::TaskPrimaryKeyDifferFromIndexPrimaryKey {
task_pk, task_pk,
index_pk, index_pk,
} => { } => {
write!(f, "primary key `{task_pk}` in task with id {id} is different from the primary key of the index `{index_pk}`") write!(f, "stopped batching before task with id {id} because its primary key `{task_pk}` is different from the primary key of the index `{index_pk}`")
} }
PrimaryKeyMismatchReason::TaskPrimaryKeyDifferFromCurrentBatchPrimaryKey { PrimaryKeyMismatchReason::TaskPrimaryKeyDifferFromCurrentBatchPrimaryKey {
task_pk, task_pk,
batch_pk, batch_pk,
} => { } => {
write!(f, "primary key `{task_pk}` in task with id {id} is different from the primary key of the batch `{batch_pk}`") write!(f, "stopped batching before task with id {id} because its primary key `{task_pk}` is different from the primary key of the batch `{batch_pk}`")
} }
PrimaryKeyMismatchReason::CannotInterfereWithPrimaryKeyGuessing { task_pk } => { PrimaryKeyMismatchReason::CannotInterfereWithPrimaryKeyGuessing { task_pk } => {
write!(f, "task with id {id} is setting the `{task_pk}` primary key but cannot interfere with primary key guessing of the batch") write!(f, "stopped batching before task with id {id} because it is setting the `{task_pk}` primary key and it would interfere with primary key guessing of the batch")
} }
}, },
BatchStopReason::IndexDeletion { id } => { BatchStopReason::IndexDeletion { id } => {
write!(f, "task with id {id} deletes the index") write!(f, "stopped after task with id {id} because it deletes the index")
} }
BatchStopReason::DocumentOperationWithSettings { id } => { BatchStopReason::DocumentOperationWithSettings { id } => {
write!( write!(
f, f,
"task with id {id} is a settings change in a batch of document operations" "stopped before task with id {id} because it is a settings change which cannot be batched with document operations"
) )
} }
BatchStopReason::DocumentOperationWithDeletionByFilter { id } => { BatchStopReason::DocumentOperationWithDeletionByFilter { id } => {
write!( write!(
f, f,
"task with id {id} is a deletion by filter in a batch of document operations" "stopped before task with id {id} because it is a deletion by filter which cannot be batched with document operations"
) )
} }
BatchStopReason::DeletionByFilterWithDocumentOperation { id } => { BatchStopReason::DeletionByFilterWithDocumentOperation { id } => {
write!( write!(
f, f,
"task with id {id} is a document operation in a batch of deletions by filter" "stopped before task with id {id} because it is a document operation which cannot be batched with deletions by filter"
) )
} }
BatchStopReason::SettingsWithDocumentOperation { id } => { BatchStopReason::SettingsWithDocumentOperation { id } => {
write!( write!(
f, f,
"task with id {id} is a document operation in a batch of settings changes" "stopped before task with id {id} because it is a document operation which cannot be batched with settings changes"
) )
} }
} }