Skip to content

Commit 0ae2c0b

Browse files
committed
fix #8593 enough: delete all the "This project needs to be restarted to support the new streaming compilation feature" code since that's wrong.
- instead set waitForInterest: true, so the call first waits (or times out) for the project to have the required service - the right way to do this would probably involve the version... but what we had would regularly fail with a wrong popup right when you start your project which is very confusing
1 parent 59da4d5 commit 0ae2c0b

File tree

4 files changed

+7
-63
lines changed

4 files changed

+7
-63
lines changed

src/packages/frontend/client/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,14 @@ export class ProjectClient {
279279
compute_server_id: opts.compute_server_id ?? 0,
280280
service: EXEC_STREAM_SERVICE,
281281
});
282-
283282
let lastSeq = -1;
284283

285284
const req = cn.requestMany(
286285
subject,
287286
{ ...opts, debug },
288287
{
289288
maxWait: (opts.timeout ?? 300) * 1000,
289+
waitForInterest: true,
290290
},
291291
);
292292
for await (const resp of await req) {

src/packages/frontend/frame-editors/generic/client.ts

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@
77
Typescript async/await rewrite of @cocalc/util/client.coffee...
88
*/
99

10-
import { Modal } from "antd";
1110
import { Map } from "immutable";
12-
1311
import { redux } from "@cocalc/frontend/app-framework";
14-
import { excludeFromComputeServer } from "@cocalc/frontend/file-associations";
1512
import { webapp_client } from "@cocalc/frontend/webapp-client";
1613
import { CompressedPatch } from "@cocalc/sync/editor/generic/types";
1714
import { callback2 } from "@cocalc/util/async-utils";
1815
import { Config as FormatterConfig } from "@cocalc/util/code-formatter";
19-
import { type UserSearchResult as User } from "@cocalc/util/db-schema/accounts";
2016
import { FakeSyncstring } from "./syncstring-fake";
17+
import { type UserSearchResult as User } from "@cocalc/util/db-schema/accounts";
2118
export { type User };
19+
import { excludeFromComputeServer } from "@cocalc/frontend/file-associations";
2220

2321
import type { ExecOpts, ExecOutput } from "@cocalc/util/db-schema/projects";
2422
export type { ExecOpts, ExecOutput };
@@ -27,40 +25,6 @@ import * as schema from "@cocalc/util/schema";
2725

2826
import { DEFAULT_FONT_SIZE } from "@cocalc/util/db-schema";
2927

30-
// Track which projects have already shown the restart dialog
31-
const shownRestartDialogs = new Set<string>();
32-
33-
export function showProjectRestartDialog(project_id: string): void {
34-
// Only show the dialog once per project
35-
if (shownRestartDialogs.has(project_id)) {
36-
return;
37-
}
38-
39-
shownRestartDialogs.add(project_id);
40-
41-
const actions = redux.getActions("projects");
42-
43-
Modal.confirm({
44-
title: "Project Needs Update",
45-
content: `This project needs to be restarted to support the new streaming compilation feature.
46-
Your work is automatically saved and will not be lost.`,
47-
okText: "Restart Project",
48-
cancelText: "Not Now",
49-
width: 500,
50-
onOk: () => {
51-
if (actions) {
52-
actions.restart_project(project_id);
53-
}
54-
// Clear the tracking when user clicks OK
55-
shownRestartDialogs.delete(project_id);
56-
},
57-
onCancel: () => {
58-
// Clear the tracking when user dismisses the dialog
59-
shownRestartDialogs.delete(project_id);
60-
},
61-
});
62-
}
63-
6428
export function server_time(): Date {
6529
return webapp_client.time_client.server_time();
6630
}

src/packages/frontend/frame-editors/latex-editor/util.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55

66
// data and functions specific to the latex editor.
77

8-
import {
9-
ExecOutput,
10-
showProjectRestartDialog,
11-
} from "@cocalc/frontend/frame-editors/generic/client";
8+
import { ExecOutput } from "@cocalc/frontend/frame-editors/generic/client";
129
import { webapp_client } from "@cocalc/frontend/webapp-client";
1310
import { ExecOptsBlocking } from "@cocalc/util/db-schema/projects";
1411
import { separate_file_extension } from "@cocalc/util/misc";
@@ -171,17 +168,7 @@ export async function runJob(opts: RunJobOpts): Promise<ExecOutput> {
171168
});
172169

173170
stream.on("error", (err) => {
174-
// Check if this is a 503 error (exec-stream service not available in old project)
175-
if (err?.code === 503) {
176-
showProjectRestartDialog(project_id);
177-
reject(err);
178-
} else {
179-
reject(
180-
new Error(
181-
"Unable to run the compilation. Please check up on the project.",
182-
),
183-
);
184-
}
171+
reject(new Error(`Unable to run the compilation. ${err}`));
185172
});
186173
});
187174
}

src/packages/frontend/frame-editors/rmd-editor/utils.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
*/
55

66
import { join } from "path";
7-
87
import { webapp_client } from "@cocalc/frontend/webapp-client";
98
import { change_filename_extension, path_split } from "@cocalc/util/misc";
109
import { ExecuteCodeOutputAsync } from "@cocalc/util/types/execute-code";
11-
import { ExecOutput, showProjectRestartDialog } from "../generic/client";
10+
import { ExecOutput } from "../generic/client";
1211

1312
// something in the rmarkdown source code replaces all spaces by dashes
1413
// [hsy] I think this is because of calling pandoc.
@@ -158,13 +157,7 @@ export async function runJob(opts: RunJobOpts): Promise<ExecOutput> {
158157
});
159158

160159
stream.on("error", (err) => {
161-
// Check if this is a 503 error (exec-stream service not available in old project)
162-
if (err?.code === 503) {
163-
showProjectRestartDialog(project_id);
164-
reject(err);
165-
} else {
166-
reject(err);
167-
}
160+
reject(err);
168161
});
169162
});
170163
}

0 commit comments

Comments
 (0)