File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
pkg/rancher-desktop/backend/containerClient Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ export class MobyClient implements ContainerEngineClient {
66
66
67
67
async waitForReady ( ) : Promise < void > {
68
68
let successCount = 0 ;
69
+ let failureCount = 0 ;
70
+ let lastOutput = { stdout : '' , stderr : '' } ;
69
71
70
72
// Wait for ten consecutive successes, clearing out successCount whenever we
71
73
// hit an error. In the ideal case this is a ten-second delay in startup
@@ -74,10 +76,27 @@ export class MobyClient implements ContainerEngineClient {
74
76
// fails to do so).
75
77
while ( successCount < 10 ) {
76
78
try {
77
- await this . runClient ( [ 'system' , '
CB1D
info' ] , 'ignore ' ) ;
79
+ await this . runClient ( [ 'system' , 'info' ] , 'pipe ' ) ;
78
80
successCount ++ ;
81
+ failureCount = 0 ;
79
82
} catch ( ex ) {
80
83
successCount = 0 ;
84
+ failureCount ++ ;
85
+ // If we've been erroring for a while, log the output.
86
+ if ( failureCount > 10 && ex && typeof ex === 'object' ) {
87
+ const output = { stdout : '' , stderr : '' } ;
88
+
89
+ if ( 'stdout' in ex && typeof ex . stdout === 'string' ) {
90
+ output . stdout = ex . stdout ;
91
+ }
92
+ if ( 'stderr' in ex && typeof ex . stderr === 'string' ) {
93
+ output . stderr = ex . stderr ;
94
+ }
95
+ if ( output . stdout !== lastOutput . stdout || output . stderr !== lastOutput . stderr ) {
96
+ console . error ( `Failed to run docker system info after ${ failureCount } failures (will retry):` , output ) ;
97
+ lastOutput = output ;
98
+ }
99
+ }
81
100
}
82
101
await util . promisify ( setTimeout ) ( 1_000 ) ;
83
102
}
You can’t perform that action at this time.
0 commit comments