Skip to content

Commit 1ae82cb

Browse files
committed
feat: implement concurrent workers
1 parent cce7a8d commit 1ae82cb

File tree

5 files changed

+91
-83
lines changed

5 files changed

+91
-83
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
redis-migrator
22
dist
3+
.test/

cmd/migrate.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ var migrateCmd = &cobra.Command{
1111
Short: "Runs redis-migrator to run migration",
1212
Long: `Runs redis-migrator to run migration`,
1313
Run: func(cmd *cobra.Command, args []string) {
14-
runMigration()
14+
if err := runMigration(); err != nil {
15+
panic(err)
16+
}
1517
},
1618
}
1719

@@ -20,7 +22,7 @@ func init() {
2022
rootCmd.AddCommand(migrateCmd)
2123
}
2224

23-
func runMigration() {
25+
func runMigration() error {
2426
data := config.ParseConfig(configFilePath)
25-
migrator.MigrateRedisData(data)
27+
return migrator.MigrateRedisData(data)
2628
}

go.mod

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
module redis-migrator
22

3-
go 1.15
3+
go 1.21
44

55
require (
6-
github.com/go-redis/redis/v8 v8.4.2
76
github.com/gomodule/redigo v1.8.3
8-
github.com/mitchellh/mapstructure v1.1.2
97
github.com/sirupsen/logrus v1.7.0
108
github.com/spf13/cobra v1.1.1
119
github.com/spf13/pflag v1.0.5
1210
gopkg.in/yaml.v2 v2.3.0
1311
)
12+
13+
require (
14+
github.com/inconshreveable/mousetrap v1.0.0 // indirect
15+
github.com/stretchr/testify v1.6.1 // indirect
16+
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect
17+
)

0 commit comments

Comments
 (0)