@@ -139,7 +139,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
139139 IO ::spin ('deploying ' );
140140 $ brefCloud ->startDeployment ($ deploymentId );
141141 } catch (Throwable $ e ) {
142- $ brefCloud ->markDeploymentFinished ($ deploymentId , false , 'Error: ' . $ e ->getMessage (), '' );
142+ try {
143+ $ brefCloud ->markDeploymentFinished ($ deploymentId , false , 'Error: ' . $ e ->getMessage (), '' );
144+ } catch (Exception $ e ) {
145+ // If we cannot mark the deployment as finished, we still want to throw the original exception
146+ }
143147 throw $ e ;
144148 }
145149 }
@@ -265,12 +269,13 @@ private function uploadArtifacts(array $config, array $packageUrls): void
265269
266270 IO ::spin ('uploading ' );
267271
272+ $ timeout = 120 ;
268273 $ client = (new HttpClientBuilder )
269274 ->retry (0 )
270275 ->intercept (new SetRequestHeader ('User-Agent ' , 'Bref CLI ' ))
271276 ->intercept (new SetRequestHeader ('Content-Type ' , 'application/json ' ))
272277 ->intercept (new SetRequestHeader ('Accept ' , 'application/json ' ))
273- ->intercept (new SetRequestTimeout (10 , 10 , 60 , 10 ))
278+ ->intercept (new SetRequestTimeout (10 , 10 , $ timeout , 60 ))
274279 ->build ();
275280
276281 $ promises = [];
@@ -294,7 +299,7 @@ private function uploadArtifacts(array $config, array $packageUrls): void
294299 try {
295300 await ($ promises );
296301 } catch (TimeoutException ) {
297- throw new Exception (' Timeout while uploading packages. Please try again. ' );
302+ throw new Exception (" Timeout while uploading packages after $ timeout seconds. This is likely due to a slow network connection " );
298303 } catch (Exception $ e ) {
299304 throw new Exception ('Error while uploading packages: ' . $ e ->getMessage (), 0 , $ e );
300305 }
0 commit comments