fix(wallet): Fixed missing loop for transfers loading.

Made channel for transfers loading buffered - non-blocking
This commit is contained in:
Ivan Belyakov 2023-06-28 15:48:37 +02:00 committed by IvanBelyakoff
parent ce45a7b1e8
commit 2f515447d2
1 changed files with 18 additions and 16 deletions

View File

@ -323,6 +323,7 @@ func loadTransfersLoop(ctx context.Context, account common.Address, blockDAO *Bl
log.Debug("loadTransfersLoop start", "chain", chainClient.ChainID, "account", account) log.Debug("loadTransfersLoop start", "chain", chainClient.ChainID, "account", account)
for {
select { select {
case <-ctx.Done(): case <-ctx.Done():
log.Info("loadTransfersLoop error", "chain", chainClient.ChainID, "account", account, "error", ctx.Err()) log.Info("loadTransfersLoop error", "chain", chainClient.ChainID, "account", account, "error", ctx.Err())
@ -341,6 +342,7 @@ func loadTransfersLoop(ctx context.Context, account common.Address, blockDAO *Bl
blocksByAddress, transactionManager, tokenManager, feed) blocksByAddress, transactionManager, tokenManager, feed)
}() }()
} }
}
} }
func newLoadBlocksAndTransfersCommand(account common.Address, db *Database, func newLoadBlocksAndTransfersCommand(account common.Address, db *Database,
@ -357,7 +359,7 @@ func newLoadBlocksAndTransfersCommand(account common.Address, db *Database,
errorsCount: 0, errorsCount: 0,
transactionManager: transactionManager, transactionManager: transactionManager,
tokenManager: tokenManager, tokenManager: tokenManager,
blocksLoadedCh: make(chan []*DBHeader), blocksLoadedCh: make(chan []*DBHeader, 100),
} }
} }