Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] Add mutex to chainListener #3433

Merged
merged 2 commits into from
Jun 7, 2022

Conversation

Liuhaai
Copy link
Member

@Liuhaai Liuhaai commented Jun 4, 2022

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

@Liuhaai Liuhaai requested a review from a team as a code owner June 4, 2022 03:25
@@ -109,6 +112,8 @@ func (cl *chainListener) AddResponder(responder apitypes.Responder) (string, err

// RemoveResponder delete the responder
func (cl *chainListener) RemoveResponder(listenerID string) (bool, error) {
cl.mu.Lock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO: line 126 & 127, if cl.streamMap.Delete may return false, we need to call it first before r.Exit()

Copy link
Member Author

Choose a reason for hiding this comment

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

if the key is missing in the map, it has been returned in L119.

@codecov
Copy link

codecov bot commented Jun 7, 2022

Codecov Report

Merging #3433 (72df748) into master (b194df6) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3433      +/-   ##
==========================================
+ Coverage   75.12%   75.14%   +0.01%     
==========================================
  Files         236      236              
  Lines       22073    22077       +4     
==========================================
+ Hits        16583    16589       +6     
+ Misses       4597     4595       -2     
  Partials      893      893              
Impacted Files Coverage Δ
api/listener.go 79.03% <100.00%> (+1.44%) ⬆️
db/trie/mptrie/branchnode.go 98.61% <0.00%> (+1.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b194df6...72df748. Read the comment docs.

@Liuhaai Liuhaai merged commit 30e0cdf into iotexproject:master Jun 7, 2022
saitofun pushed a commit that referenced this pull request Jun 8, 2022
saitofun pushed a commit that referenced this pull request Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants