refactor: enhance error messages for max retries in partition and batch processing

This commit is contained in:
2026-05-08 23:36:59 -05:00
parent b5fd6d0534
commit d124da8b20
2 changed files with 4 additions and 7 deletions

View File

@@ -50,7 +50,7 @@ func (ex *GenericExtractor) ProcessPartitionWithRetries(
if currentParitition.RetryCounter >= retryConfig.Attempts {
return totalRowsRead, &custom_errors.JobError{
Msg: fmt.Sprintf("Partition %v reached max retries", exError.Partition.Id),
Msg: fmt.Sprintf("Partition %v reached max retries (%d)", currentParitition.Id, currentParitition.RetryCounter),
Prev: err,
}
}

View File

@@ -18,7 +18,6 @@ func (gl *GenericLoader) ProcessBatchWithRetries(
retryConfig config.RetryConfig,
batch models.Batch,
) (int64, error) {
retries := 0
for {
rowsLoaded, err := gl.ProcessBatch(ctx, tableInfo, colNames, batch)
if err == nil {
@@ -26,13 +25,11 @@ func (gl *GenericLoader) ProcessBatchWithRetries(
}
if btError, ok := errors.AsType[*custom_errors.LoaderError](err); ok {
retries++
batch.RetryCounter = retries
batch.RetryCounter++
if batch.RetryCounter >= retryConfig.Attempts {
return rowsLoaded, &custom_errors.JobError{
ShouldCancelJob: false,
Msg: fmt.Sprintf("Temporal error in batch %v (retries: %d)", btError.Batch.Id, btError.Batch.RetryCounter),
Msg: fmt.Sprintf("Batch %v reached max retries (%d)", batch.Id, batch.RetryCounter),
Prev: btError,
}
}