feat: add context support to migration job processing for improved cancellation and error handling

This commit is contained in:
2026-04-09 00:43:11 -05:00
parent b64a76ca45
commit a0b51f40c1
2 changed files with 21 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"context"
"time"
log "github.com/sirupsen/logrus"
@@ -37,6 +38,10 @@ const (
func main() {
configureLog()
startTime := time.Now()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
log.Info("=== Starting migration ===")
log.Infof("Number of loaders: %d, Chunk size: %d", NumLoaders, ChunkSize)
@@ -50,7 +55,7 @@ func main() {
for _, job := range migrationJobs {
log.Infof(">>> Processing job: %s.%s <<<", job.Schema, job.Table)
processMigrationJob(sourceDb, targetDb, job)
processMigrationJob(ctx, sourceDb, targetDb, job)
}
totalDuration := time.Since(startTime)