Skip to content

Commit

Permalink
use defer to close chan
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Nov 27, 2024
1 parent 7f81b42 commit 3364153
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion indexer/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ func Test_ListenFinalizeBlock_Subscribe(t *testing.T) {
defer app.Close()

blockChan, logsChan, pendChan := indexer.Subscribe()
close(pendChan)
defer close(blockChan)
defer close(logsChan)
defer close(pendChan)

tx, evmTxHash := tests.GenerateCreateERC20Tx(t, app, privKeys[0])

Expand Down
5 changes: 3 additions & 2 deletions indexer/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ func Test_Mempool_Subscribe(t *testing.T) {
defer app.Close()

blockChan, logsChan, pendChan := indexer.Subscribe()
close(blockChan)
close(logsChan)
defer close(blockChan)
defer close(logsChan)
defer close(pendChan)

tx, evmTxHash := tests.GenerateCreateERC20Tx(t, app, privKeys[0])

Expand Down

0 comments on commit 3364153

Please sign in to comment.