File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ import {
64
64
syntax2tool ,
65
65
} from "@cocalc/util/code-formatter" ;
66
66
import {
67
- IS_TIMEOUT_CALLING_PROJECT ,
67
+ isTimeoutCallingProject ,
68
68
TIMEOUT_CALLING_PROJECT_MSG ,
69
69
} from "@cocalc/util/consts/project" ;
70
70
import {
@@ -1921,7 +1921,7 @@ export class Actions<
1921
1921
if ( error === undefined ) {
1922
1922
return "" ;
1923
1923
}
1924
- if ( IS_TIMEOUT_CALLING_PROJECT ( error ) ) {
1924
+ if ( isTimeoutCallingProject ( error ) ) {
1925
1925
return TIMEOUT_CALLING_PROJECT_MSG ;
1926
1926
}
1927
1927
if ( typeof error == "string" ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
10
10
ExecOpts ,
11
11
ExecOutput ,
12
12
} from "@cocalc/frontend/frame-editors/generic/client" ;
13
- import { IS_TIMEOUT_CALLING_PROJECT } from "@cocalc/util/consts/project" ;
13
+ import { isTimeoutCallingProject } from "@cocalc/util/consts/project" ;
14
14
import { ExecOptsBlocking } from "@cocalc/util/db-schema/projects" ;
15
15
import { separate_file_extension } from "@cocalc/util/misc" ;
16
16
import { ExecuteCodeOutputAsync } from "@cocalc/util/types/execute-code" ;
@@ -177,7 +177,7 @@ export async function runJob(opts: RunJobOpts): Promise<ExecOutput> {
177
177
set_job_info ( output ) ;
178
178
return output ;
179
179
} catch ( err ) {
180
- if ( IS_TIMEOUT_CALLING_PROJECT ( err ) ) {
180
+ if ( isTimeoutCallingProject ( err ) ) {
181
181
// This will eventually be fine, hopefully. We continue trying to get a reply.
182
182
await delay ( 100 ) ;
183
183
} else {
Original file line number Diff line number Diff line change @@ -10,9 +10,20 @@ export const TIMEOUT_CALLING_PROJECT = "timeout";
10
10
export const TIMEOUT_CALLING_PROJECT_MSG =
11
11
"Timeout communicating with project." ;
12
12
13
- export const IS_TIMEOUT_CALLING_PROJECT = ( err ) => {
13
+ /**
14
+ * Checks if an error represents a timeout when communicating with a project.
15
+ *
16
+ * Handles both legacy and conat-based timeout errors:
17
+ * - Legacy: String "timeout"
18
+ * - Conat: ConatError with code 408 (HTTP Request Timeout)
19
+ * See @cocalc/conat/core/client.ts lines 1391, 1937-1939 where 408 timeouts are thrown
20
+ */
21
+ export function isTimeoutCallingProject ( err ) : boolean {
14
22
if ( err === TIMEOUT_CALLING_PROJECT ) {
15
23
return true ;
16
24
}
25
+ if ( err ?. constructor ?. name === "ConatError" && err ?. code === 408 ) {
26
+ return true ;
27
+ }
17
28
return false ;
18
- } ;
29
+ }
You can’t perform that action at this time.
0 commit comments