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

fix #655 Repeated subscriptions result in multiple callbacks #674

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

yesAnd92
Copy link

bug

初始化vo.SubscribeParam的SubscribeCallback属性时是值传递,导致"订阅”和"取消订阅"两次请求传入的回调函数不同,取消订阅逻辑总无法清除对应的callback从而产生这个bug #655

fix

将SubscribeCallback定义为指针类型的函数,保证"取消订阅"请求时两次回调函数符合相等性的判断。

result

Snipaste_2023-10-30_17-14-34

Copy link
Member

@binbin0325 binbin0325 left a comment

Choose a reason for hiding this comment

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

use error, you can define the SubscribeParam variable and pass it to Subscribe,Unsubscribe

Copy link
Member

@binbin0325 binbin0325 left a comment

Choose a reason for hiding this comment

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

It's not the same problem #655 is trying to solve

@yesAnd92
Copy link
Author

yesAnd92 commented Nov 2, 2023

Add duplicate check during subscription

@codecov-commenter
Copy link

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (4eb0559) 29.71% compared to head (6fde0a8) 29.93%.
Report is 1 commits behind head on master.

❗ Current head 6fde0a8 differs from pull request most recent head 5cd83e1. Consider uploading reports for the commit 5cd83e1 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #674      +/-   ##
==========================================
+ Coverage   29.71%   29.93%   +0.21%     
==========================================
  Files          40       40              
  Lines        3093     3097       +4     
==========================================
+ Hits          919      927       +8     
+ Misses       2104     2102       -2     
+ Partials       70       68       -2     
Files Coverage Δ
...s/naming_client/naming_cache/subscribe_callback.go 68.42% <60.00%> (-2.17%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yesAnd92
Copy link
Author

@binbin0325 这个pr是否符合要求?pending好久了

@binbin0325
Copy link
Member

@binbin0325 这个pr是否符合要求?pending好久了

符合要求,本周再重点看下

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