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

Implement retry mechanism for read endpoints #31

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

LINCKODE
Copy link
Member

Add retry mechanism for all endpoints that request data from nodes and update vulnerable dependencies.

@LINCKODE LINCKODE linked an issue Jan 23, 2025 that may be closed by this pull request
@LINCKODE LINCKODE requested review from 0xluk and qubicmio January 23, 2025 13:35
@qubicmio
Copy link

lgtm (except the retry code duplication - not sure if there is a way to make that nicer)

@0xluk
Copy link
Collaborator

0xluk commented Jan 24, 2025

lgtm (except the retry code duplication - not sure if there is a way to make that nicer)

@qubicmio I addressed that in the review

@@ -37,8 +37,7 @@ type Server struct {
readRetryCount int
}

func NewServer(listenAddrGRPC, listenAddrHTTP string, logger *log.Logger,
qPool *qubic.Pool, maxTickFetchUrl string, readRetryCount int) *Server {
func NewServer(listenAddrGRPC, listenAddrHTTP string, logger *log.Logger, qPool *qubic.Pool, maxTickFetchUrl string, readRetryCount int) *Server {
Copy link
Collaborator

Choose a reason for hiding this comment

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

readRetryCount is not a proper variable time as from a config point of view it's not a count but a readMaxRetries

return 0, errors.Wrap(err, "performing request")
}
defer res.Body.Close()
for attempt := 0; attempt <= maxRetries; attempt++ {
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't this be attempt < maxRetries

@@ -32,6 +32,7 @@ func run(logger *log.Logger) error {
HttpHost string `conf:"default:0.0.0.0:8000"`
GrpcHost string `conf:"default:0.0.0.0:8001"`
MaxTickFetchUrl string `conf:"default:http://127.0.0.1:8080/max-tick"`
ReadRetryCount int `conf:"default:5"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, it's not a count

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.

retry mechanism for read operations
3 participants