fix(mindspace): release edited public pages and fix achievements dates
Memind CI / Test, build, and release guards (push) Successful in 3m37s
Memind CI / Test, build, and release guards (push) Successful in 3m37s
Finish now releases static HTML delivery contracts in a finally block so re-edited pages are not stuck at HTTP 409, and M成果 groups pages by Asia/Shanghai calendar dates to avoid duplicate day headings. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+16
-16
@@ -1,7 +1,7 @@
|
||||
import crypto from 'node:crypto';
|
||||
import path from 'node:path';
|
||||
import { buildChatSkillPrompt, SCHEDULED_TASK_AUTOMATION_SKILL_NAME } from './chat-skills.mjs';
|
||||
import { markPageDeliveryContractReady } from './mindspace-delivery-contract.mjs';
|
||||
import { releaseMaterializedPageDeliveryContracts } from './mindspace-delivery-contract.mjs';
|
||||
import {
|
||||
collectOwnPublicHtmlRelativePaths,
|
||||
materializeMissingPublicHtmlWrites,
|
||||
@@ -126,29 +126,29 @@ export async function finalizeScheduledTaskPageDelivery({
|
||||
const [rows] = await pool.query(
|
||||
`SELECT workspace_relative_path
|
||||
FROM h5_page_delivery_contracts
|
||||
WHERE user_id = ? AND request_id = ? AND status = 'preparing'`,
|
||||
[userId, sessionId],
|
||||
WHERE user_id = ? AND status = 'preparing'`,
|
||||
[userId],
|
||||
);
|
||||
for (const row of rows ?? []) {
|
||||
if (row?.workspace_relative_path) relativePaths.add(row.workspace_relative_path);
|
||||
}
|
||||
}
|
||||
|
||||
const readyPaths = [];
|
||||
for (const relativePath of relativePaths) {
|
||||
const ready = await markPageDeliveryContractReady({
|
||||
pool,
|
||||
const readyPaths = await releaseMaterializedPageDeliveryContracts({
|
||||
pool,
|
||||
userId,
|
||||
relativePaths: [...relativePaths],
|
||||
allowPgRequired: true,
|
||||
}).catch((error) => {
|
||||
logger.warn?.('[ScheduledTask] release delivery contracts failed:', error);
|
||||
return [];
|
||||
});
|
||||
for (const relativePath of readyPaths) {
|
||||
logger.info?.('[ScheduledTask] delivery contract ready', {
|
||||
userId,
|
||||
sessionId,
|
||||
relativePath,
|
||||
}).catch(() => false);
|
||||
if (ready) readyPaths.push(relativePath);
|
||||
else {
|
||||
logger.warn?.('[ScheduledTask] delivery contract not ready', {
|
||||
userId,
|
||||
sessionId,
|
||||
relativePath,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return readyPaths;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user