refactor: enhance error messages for max retries in partition and batch processing
This commit is contained in:
@@ -50,7 +50,7 @@ func (ex *GenericExtractor) ProcessPartitionWithRetries(
|
|||||||
|
|
||||||
if currentParitition.RetryCounter >= retryConfig.Attempts {
|
if currentParitition.RetryCounter >= retryConfig.Attempts {
|
||||||
return totalRowsRead, &custom_errors.JobError{
|
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,
|
Prev: err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ func (gl *GenericLoader) ProcessBatchWithRetries(
|
|||||||
retryConfig config.RetryConfig,
|
retryConfig config.RetryConfig,
|
||||||
batch models.Batch,
|
batch models.Batch,
|
||||||
) (int64, error) {
|
) (int64, error) {
|
||||||
retries := 0
|
|
||||||
for {
|
for {
|
||||||
rowsLoaded, err := gl.ProcessBatch(ctx, tableInfo, colNames, batch)
|
rowsLoaded, err := gl.ProcessBatch(ctx, tableInfo, colNames, batch)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -26,13 +25,11 @@ func (gl *GenericLoader) ProcessBatchWithRetries(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if btError, ok := errors.AsType[*custom_errors.LoaderError](err); ok {
|
if btError, ok := errors.AsType[*custom_errors.LoaderError](err); ok {
|
||||||
retries++
|
batch.RetryCounter++
|
||||||
batch.RetryCounter = retries
|
|
||||||
|
|
||||||
if batch.RetryCounter >= retryConfig.Attempts {
|
if batch.RetryCounter >= retryConfig.Attempts {
|
||||||
return rowsLoaded, &custom_errors.JobError{
|
return rowsLoaded, &custom_errors.JobError{
|
||||||
ShouldCancelJob: false,
|
Msg: fmt.Sprintf("Batch %v reached max retries (%d)", batch.Id, batch.RetryCounter),
|
||||||
Msg: fmt.Sprintf("Temporal error in batch %v (retries: %d)", btError.Batch.Id, btError.Batch.RetryCounter),
|
|
||||||
Prev: btError,
|
Prev: btError,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user