Comments (5)
Reconnect is an interesting case:
- If the service is established, and
svc.poll_ready()
is an error,Reconnect
swallows it, tosses thesvc
, and callsnew_service()
. - If the
Future
fromnew_service
itself errors, thenReconnect
determines it cannot ever get back up, and returns the connect (NewService::InitError
) error.
I don't think the proposed change hurts Reconnect
. If anything, it gives it a little more context. It could be adjusted to always reconnect when Status::Closed
, but perhaps keep a count of Err
s and return after a limit, or something else entirely.
from tower.
As a comparison, futures mpsc channel has poll_ready
as well, and currently encodes the closed state as a Disconnected
SendError
.
from tower.
As a part of this change, I think we should explicitly document that poll_ready errors should be considered fatal. If that can't be the case today (i.e. in reconnect), then we may want to figure out if Status
needs to handle the case of benign failures.
from tower.
Before moving forward with this, I would like to discover a case that is made possible with this change.
A service closing normally can be represented with an Error
type today, however there is no standard way to do this. Middleware implementations can always define a trait and require that the inner service's error type implement that trait. In order to justify a change like this, it should provide benefit to the majority of cases.
The original example was a connection pool, where the connection pool needs to know if an inner service failed unexpectedly or closed gracefully. In this example, it is not obvious to me that the connection pool needs to know this. The pool should shield its caller from the details of each individual connection and individual connections may fail without any implication to other connections.
So, I would say this should be a "won't fix" until there is a solid use case driving it.
from tower.
I'm going to close this as it seems that we are leaning towards "won't fix"
from tower.
Related Issues (20)
- Publish `0.5` release HOT 5
- `Retry<RetryPolicy, RateLimit<Client>>` does not work HOT 7
- Idea: Preventing Inappropriate Service Invocation HOT 1
- Returning a response from a tower layer HOT 2
- AsyncFilterLayer is missing Clone impl
- Have MakeBalance and MakeBalanceLayer example?
- `Reconnect::new()` Generic parameters are redundant HOT 2
- Adding option_layer causes trait bound unsastisfied HOT 1
- Publish release without pin-project (with pin-project-lite) HOT 4
- `tower::service_fn` docs don't say that you need the `util` flag HOT 3
- MQTT client adapter / framework HOT 1
- βFan outβ services? HOT 3
- Consider using `ControlFlow` for retry `Policy`.
- Extending `Building a middleware from scratch` guide
- breaking change in tower design (0.6 or beyond): first class support for async fn traits HOT 20
- unexpected behaviour of `RateLimit`
- experiment with permit based service framework HOT 5
- Tower & Warp server error
- Rate Limit Layer not Respected HOT 1
- Feature Request: implement `layer` method on `ServiceExt` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tower.