-
Notifications
You must be signed in to change notification settings - Fork 42
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
added connection and retry options for jsm client #408
added connection and retry options for jsm client #408
Conversation
Codecov Report
@@ Coverage Diff @@
## main #408 +/- ##
=======================================
Coverage 38.97% 38.97%
=======================================
Files 29 29
Lines 1919 1919
=======================================
Hits 748 748
Misses 1125 1125
Partials 46 46 |
/assign @dan-j |
@astelmashenko: GitHub didn't allow me to assign the following users: dan-j. Note that only knative-sandbox members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@matzew , work is complete, ready for review. Are you going to review or should I assign somebody else (before I worked with Evan Anderson and Lionel Villard)? |
cc @dan-j |
/assign @matzew |
/assign @lionelvillard |
Apologies, just caught up on notifications and seen this. Changes seem sensible, thanks for the contribution! I'm not sure I have permissions to lgtm/approve but trying anyway /lgtm |
@dan-j: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@evankanderson , could you please review and put lgtm label? |
/lgtm |
@astelmashenko: you cannot LGTM your own PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
pkg/common/nats/conn.go
Outdated
// reconnection options | ||
if config.ConnOpts.RetryOnFailedConnect { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to check for config.ConnOpts != nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
// ReconnectWait time between reconnects in milliseconds | ||
ReconnectWait time.Duration `json:"reconnectWait,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, Kubernetes recommends to have the unit in the name: https://github.com/zecke/Kubernetes/blob/master/docs/devel/api-conventions.md#units and the type being just int
the reason being, time.Duration is a Go only type and format, so it limits the client that can easily use the API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
pkg/common/nats/conn.go
Outdated
if attempts < 5 { | ||
logger.Infof("Attempts left: %d", config.ConnOpts.MaxReconnects-attempts) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is 5 hardcoded here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to show 5 last messages of recconnecting attepmts. Should I give it a name, make it debug and log everything or just remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@astelmashenko @dan-j Regarding |
…d magic number and changed log to be debug
I'm already able to |
@pierDipi , could you please take a look. I've addressed all the comments. |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: astelmashenko, dan-j, pierDipi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cherrypick main |
@astelmashenko: base branch (main) needs to differ from target branch (main) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Proposed Changes
The PR introduces reconnect options, connection handler to log in case of connection lost or reconnect attempts finished. In case it could not reconnect it halts dispatcher, so k8s can restart it.
Release Note