Skip to content

Commit 10646ee

Browse files
committed
cocalc-api/mcp: touch project when in use
1 parent 157721b commit 10646ee

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/packages/next/pages/api/conat/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export default async function handle(req, res) {
5757
name,
5858
args,
5959
timeout,
60+
account_id,
6061
});
6162
res.json(resp);
6263
} catch (err) {

src/packages/server/api/project-bridge.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ export default async function projectBridge({
1414
name,
1515
args,
1616
timeout,
17+
account_id,
1718
}: {
1819
project_id: string;
1920
compute_server_id?: number;
2021
name: string;
2122
args?: any[];
2223
timeout?: number;
24+
account_id?: string;
2325
}) {
2426
client ??= conat();
2527
return await callProject({
@@ -29,6 +31,7 @@ export default async function projectBridge({
2931
name,
3032
args,
3133
timeout,
34+
account_id,
3235
});
3336
}
3437

@@ -39,24 +42,26 @@ async function callProject({
3942
name,
4043
args = [],
4144
timeout = DEFAULT_TIMEOUT,
45+
account_id,
4246
}: {
4347
client: ConatClient;
4448
project_id: string;
4549
compute_server_id?: number;
4650
name: string;
4751
args?: any[];
4852
timeout?: number;
53+
account_id?: string;
4954
}) {
5055
const subject = projectSubject({
5156
project_id,
5257
compute_server_id,
5358
service: "api",
5459
});
5560
try {
56-
// Ensure the project is running before making the API call
61+
// Ensure the project is running and signal activity before making the API call
5762
const project = getProject(project_id);
5863
if (project) {
59-
await project.start();
64+
await project.touch(account_id);
6065
}
6166

6267
// For discovery-style calls, inject identifiers so the project can report scope

0 commit comments

Comments
 (0)