Skip to content

Commit

Permalink
Fix concurrent problem
Browse files Browse the repository at this point in the history
  • Loading branch information
SpontaneousOverthrow committed Nov 21, 2023
1 parent 570e911 commit 394ba61
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
19 changes: 10 additions & 9 deletions cmd/convert/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ func process(data *dataIn) error {
return err
}

// Convert Wallets
eg := errgroup.Group{}

// Get Accounts Wallets Map
walletsMap, err := iStore.GetWalletsAccountsMap()
if err != nil {
return err
}

// Converting Wallets
for wName, aNames := range walletsMap {
// Goroutines
eg := errgroup.Group{}
eg.Go(func() error {
// Create Wallet In Output Store
err := oStore.CreateWallet(wName)
Expand All @@ -44,12 +46,11 @@ func process(data *dataIn) error {
}
return nil
})
}

// Only First Error Will Be Displayed
err = eg.Wait()
if err != nil {
return err
// Only First Error Will Be Displayed
err = eg.Wait()
if err != nil {
return err
}
}

return nil
Expand Down
1 change: 0 additions & 1 deletion utils/store/distributed.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ func (s *DistributedStore) SavePKToWallet(w string, a []byte, n string) error {
defer func() {
err = wallet.(types.WalletLocker).Lock(s.Ctx)
}()
fmt.Println("test")

_, err = wallet.(types.WalletDistributedAccountImporter).ImportDistributedAccount(
s.Ctx,
Expand Down

0 comments on commit 394ba61

Please sign in to comment.