Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

add vaildate-block #1815

Merged
merged 3 commits into from
Nov 29, 2019
Merged

add vaildate-block #1815

merged 3 commits into from
Nov 29, 2019

Conversation

Paladz
Copy link
Contributor

@Paladz Paladz commented Nov 29, 2019

No description provided.

}

func validateTxWorker(workCh chan *validateTxWork, resultCh chan *ValidateTxResult, closeCh chan struct{}, wg *sync.WaitGroup) {
for {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我记得直接可以使用for对workCh遍历,外部只要close workCh就可以退出循环了。这样可以不要不用搞个closeCh出来了

close(closeCh)
wg.Wait()
close(workCh)
close(resultCh)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果没有正式的目的,channel不需要关闭
https://stackoverflow.com/questions/8593645/is-it-ok-to-leave-a-channel-open

@Paladz Paladz merged commit 1d6886a into dev Nov 29, 2019
@Paladz Paladz deleted the batch-vaildate-tx branch November 29, 2019 08:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants