Skip to content

[management] Refactor/management/updchannel #3645

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

Merged
merged 2 commits into from
Apr 11, 2025

Conversation

crn4
Copy link
Contributor

@crn4 crn4 commented Apr 8, 2025

Describe your changes

Replaced write lock with read lock for peerChannels map access where only read operations are performed

Issue ticket number and link

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

@Copilot Copilot AI review requested due to automatic review settings April 8, 2025 20:05
@CLAassistant
Copy link

CLAassistant commented Apr 8, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

management/server/updatechannel.go:45

  • Ensure that using RLock in SendUpdate is safe because this function must not perform any modifications on the peerChannels map. If a write operation is introduced in the future, a write lock should be used.
p.channelsMux.RLock()

management/server/updatechannel.go:144

  • Verify that the use of RLock in GetAllConnectedPeers is appropriate as this function should only read from the peerChannels map. Any future changes requiring modifications to the map would necessitate reverting to a write lock.
p.channelsMux.RLock()

management/server/updatechannel.go:166

  • Confirm that HasChannel remains read-only when accessing the peerChannels map, ensuring that the read lock is sufficient. If the implementation changes to mutate the map, a write lock will be required.
p.channelsMux.RLock()

Copy link

sonarqubecloud bot commented Apr 8, 2025

@bcmmbaga bcmmbaga changed the title Refactor/management/updchannel [management] Refactor/management/updchannel Apr 11, 2025
@bcmmbaga bcmmbaga merged commit 7839d2c into main Apr 11, 2025
34 checks passed
@bcmmbaga bcmmbaga deleted the refactor/management/updchannel branch April 11, 2025 15:23
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