@@ -156,7 +156,7 @@ private async Task InitializeServicesAsync()
156156 credentialLoadCts . CancelAfter ( TimeSpan . FromSeconds ( 15 ) ) ;
157157
158158 var loadCredentialsTask = credentialManager . LoadCredentials ( credentialLoadCts . Token ) ;
159- var reconnectTask = ReconnectWithStartupRetryAsync ( rpcController , appStopping ) ;
159+ var reconnectTask = rpcController . Reconnect ( appStopping ) ;
160160
161161 try
162162 {
@@ -173,10 +173,7 @@ private async Task InitializeServicesAsync()
173173 AppBootstrapLogger . Error ( "Startup reconnect failed unexpectedly" , reconnectTask . Exception ? . GetBaseException ( ) ) ;
174174 }
175175
176- var reconnectSucceeded = reconnectTask is { IsCompletedSuccessfully : true , Result : true } ;
177-
178- if ( ! reconnectSucceeded )
179- AppBootstrapLogger . Warn ( "Startup continuing in disconnected state after retry exhaustion" ) ;
176+ var reconnectSucceeded = reconnectTask . IsCompletedSuccessfully ;
180177
181178 try
182179 {
@@ -188,41 +185,6 @@ private async Task InitializeServicesAsync()
188185 }
189186 }
190187
191- private async Task < bool > ReconnectWithStartupRetryAsync ( IRpcController rpcController , CancellationToken ct )
192- {
193- TimeSpan [ ] delays =
194- [
195- TimeSpan . Zero ,
196- TimeSpan . FromSeconds ( 1 ) ,
197- TimeSpan . FromSeconds ( 2 ) ,
198- TimeSpan . FromSeconds ( 4 ) ,
199- TimeSpan . FromSeconds ( 8 ) ,
200- ] ;
201-
202- Exception ? lastError = null ;
203-
204- for ( var attempt = 0 ; attempt < delays . Length ; attempt ++ )
205- {
206- if ( attempt > 0 )
207- await Task . Delay ( delays [ attempt ] , ct ) ;
208-
209- try
210- {
211- await rpcController . Reconnect ( ct ) ;
212- AppBootstrapLogger . Info ( $ "RPC reconnect succeeded on attempt { attempt + 1 } /{ delays . Length } ") ;
213- return true ;
214- }
215- catch ( Exception ex ) when ( ! ct . IsCancellationRequested )
216- {
217- lastError = ex ;
218- AppBootstrapLogger . Warn ( $ "RPC reconnect attempt { attempt + 1 } /{ delays . Length } failed: { ex . Message } ") ;
219- }
220- }
221-
222- AppBootstrapLogger . Error ( "RPC reconnect exhausted startup retries" , lastError ) ;
223- return false ;
224- }
225-
226188 private async Task MaybeAutoStartVpnOnLaunchAsync (
227189 ISettingsManager < CoderConnectSettings > settingsManager ,
228190 ICredentialManager credentialManager ,
0 commit comments