File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -123,8 +123,7 @@ impl OuterClient {
123123 }
124124
125125 async fn ensure_initialized ( & self ) {
126- let inner = self . 0 . load ( ) ;
127- if inner. is_none ( ) || inner. as_ref ( ) . is_some_and ( |c| !c. is_healthy ( ) ) {
126+ if !self . is_healthy ( ) {
128127 let client = self . initialize ( ) . await ;
129128 self . 0 . store ( Some ( Arc :: new ( client) ) ) ;
130129 }
@@ -138,6 +137,14 @@ impl OuterClient {
138137 . await
139138 . expect ( "Infinite retries should never return Err" )
140139 }
140+
141+ /// When `false` is returned, the next call to the client will attempt to restore the connection.
142+ ///
143+ /// This function can be used to propagate healthiness info to a consumer service.
144+ pub fn is_healthy ( & self ) -> bool {
145+ let inner = self . 0 . load ( ) ;
146+ inner. as_ref ( ) . is_some_and ( |c| c. is_healthy ( ) )
147+ }
141148}
142149
143150// TOOD: Set max retries to `None`;
You can’t perform that action at this time.
0 commit comments