Skip to content

Commit

Permalink
feat: implement concurrent workers
Browse files Browse the repository at this point in the history
  • Loading branch information
huantt committed Oct 18, 2023
1 parent cce7a8d commit 1ae82cb
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 83 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
redis-migrator
dist
.test/
8 changes: 5 additions & 3 deletions cmd/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ var migrateCmd = &cobra.Command{
Short: "Runs redis-migrator to run migration",
Long: `Runs redis-migrator to run migration`,
Run: func(cmd *cobra.Command, args []string) {
runMigration()
if err := runMigration(); err != nil {
panic(err)
}
},
}

Expand All @@ -20,7 +22,7 @@ func init() {
rootCmd.AddCommand(migrateCmd)
}

func runMigration() {
func runMigration() error {
data := config.ParseConfig(configFilePath)
migrator.MigrateRedisData(data)
return migrator.MigrateRedisData(data)
}
10 changes: 7 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
module redis-migrator

go 1.15
go 1.21

require (
github.com/go-redis/redis/v8 v8.4.2
github.com/gomodule/redigo v1.8.3
github.com/mitchellh/mapstructure v1.1.2
github.com/sirupsen/logrus v1.7.0
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5
gopkg.in/yaml.v2 v2.3.0
)

require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/stretchr/testify v1.6.1 // indirect
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect
)
Loading

0 comments on commit 1ae82cb

Please sign in to comment.