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 deleting of subscriber and recovering #85

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

aneeshkp
Copy link
Member

@aneeshkp aneeshkp commented Mar 6, 2023

Fixes issue: the client does not recover if a client comes back after it is marked for delete due to inactivity.

if err = h.NewSender(obj.ClientID, obj.GetEndPointURI()); err != nil {
log.Errorf("(1)error creating subscriber %v for address %s", err, obj.GetEndPointURI())
localmetrics.UpdateSenderCreatedCount(obj.GetEndPointURI(), localmetrics.FAILED, 1)
} else if _, err = h.subscriberAPI.CreateSubscription(obj.ClientID, obj); err != nil {
log.Infof("failed creating subscription for %s", obj.ClientID.String())
out.Status = channel.FAILED

Choose a reason for hiding this comment

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

you dont need this line as you are setting status to failed just before the if/else block. That being said you are better off just setting the status in each if/else condition for better readability

if err = h.NewSender(obj.ClientID, obj.GetEndPointURI()); err != nil {
log.Errorf("(1)error creating subscriber %v for address %s", err, obj.GetEndPointURI())
localmetrics.UpdateSenderCreatedCount(obj.GetEndPointURI(), localmetrics.FAILED, 1)
} else if _, err = h.subscriberAPI.CreateSubscription(obj.ClientID, obj); err != nil {
log.Infof("failed creating subscription for %s", obj.ClientID.String())

Choose a reason for hiding this comment

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

should this be info or error?

Signed-off-by: Aneesh Puttur <aneeshputtur@gmail.com>
@aneeshkp aneeshkp merged commit 58c5e67 into redhat-cne:main Mar 7, 2023
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