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

reconnect: Fix maker error to return in future #386

Closed
wants to merge 1 commit into from

Conversation

LucioFranco
Copy link
Member

Fixes #383

These changes reconnect to return the make service failure in the future instead of in poll_ready. This change allows us to reuse the reconnect service on failed reconnects. This pushes the error down to the caller of call since technically the make_service is ready. This makes it so you can keep calling call until the service reconnects.

This service is a bit odd, because it doesn't really fit in with the other types of services. This is because its an adapter to go from MakeService to Service. Thus, the poll_ready contract here doesn't mean the same as a regular Service because it has to bundle connecting.

This question brings up a big issue with how buffer is implemented, because if poll_ready returns the error then we must throw away the service, and buffer will just keep returning the failed connection error, even if we can successfully reestablish.

@LucioFranco LucioFranco requested review from a team and seanmonstar December 11, 2019 18:07
@seanmonstar
Copy link
Collaborator

Hm, this is a significant behavior change, I'll need to think through its repercussions. This also seems related to #244.

@LucioFranco
Copy link
Member Author

Yeah, 100% related, funny how I came to the same conclusion again naturally #244 (comment)

@seanmonstar so I guess if we think about it this way, a service should be thrown away if poll_ready returns an error, in this case its not returning an error thus our inner service is valid. Therefore, it makes sense to return a make_service error on call since we got that error from call and not from poll_ready.

@LucioFranco LucioFranco mentioned this pull request Dec 19, 2019
17 tasks
@LucioFranco
Copy link
Member Author

@seanmonstar friendly ping

@jonhoo jonhoo added the A-reconnect Area: The tower "reconnect" middleware label Mar 31, 2020
Copy link
Collaborator

@seanmonstar seanmonstar 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 been working in tonic, let's go!

@LucioFranco
Copy link
Member Author

I am going to reopen this since we moved things around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-reconnect Area: The tower "reconnect" middleware
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Service never attempts to reconnect
3 participants