File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -102,16 +102,21 @@ impl DatabaseConnection {
102102 let http = HttpStrategy :: new ( reqwest_client, turso_config. clone ( ) ) ;
103103 let mut websocket = WebSocketStrategy :: new ( turso_config. clone ( ) ) ;
104104
105- websocket. connect ( ) . await ?;
106-
107- if cfg ! ( debug_assertions) {
108- println ! ( "WebSocket connection established for {}" , db_name) ;
109- }
105+ let connection = websocket. connect ( ) . await ;
106+ let strategy: ActiveStrategy = match connection {
107+ Ok ( _) => ActiveStrategy :: Websocket ,
108+ Err ( err) => {
109+ if cfg ! ( debug_assertions) {
110+ println ! ( "WebSocket connection failed: {}" , err) ;
111+ }
112+ ActiveStrategy :: Http
113+ }
114+ } ;
110115
111116 Ok ( Self {
112117 http,
113118 websocket,
114- strategy : ActiveStrategy :: Websocket ,
119+ strategy,
115120 } )
116121 }
117122
You can’t perform that action at this time.
0 commit comments