feat: refactor models to improve type handling and enhance error management across migration processes
This commit is contained in:
@@ -4,10 +4,13 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"git.ksdemosapps.com/kylesoda/go-migrate/internal/app/custom_errors"
|
||||
"git.ksdemosapps.com/kylesoda/go-migrate/internal/app/models"
|
||||
)
|
||||
|
||||
type LoaderError struct {
|
||||
Chunk
|
||||
models.Chunk
|
||||
Msg string
|
||||
}
|
||||
|
||||
@@ -18,8 +21,8 @@ func (e *LoaderError) Error() string {
|
||||
func loaderErrorHandler(
|
||||
ctx context.Context,
|
||||
chErrorsIn <-chan LoaderError,
|
||||
chChunksOut chan<- Chunk,
|
||||
chJobErrorsOut chan<- JobError,
|
||||
chChunksOut chan<- models.Chunk,
|
||||
chJobErrorsOut chan<- custom_errors.JobError,
|
||||
wgActiveChunks *sync.WaitGroup,
|
||||
) {
|
||||
for {
|
||||
@@ -37,7 +40,7 @@ func loaderErrorHandler(
|
||||
}
|
||||
|
||||
if err.RetryCounter >= maxRetryAttempts {
|
||||
jobError := JobError{
|
||||
jobError := custom_errors.JobError{
|
||||
ShouldCancelJob: false,
|
||||
Msg: fmt.Sprintf("chunk %v reached max retries (%d)", err.Id, maxRetryAttempts),
|
||||
Prev: &err,
|
||||
|
||||
Reference in New Issue
Block a user