diff --git a/src/routes/myResources.js b/src/routes/myResources.js index 068726e2..94cf6a5e 100644 --- a/src/routes/myResources.js +++ b/src/routes/myResources.js @@ -617,8 +617,13 @@ async function runResourceJob(jobId, userId, body, kind, resourceId) { // leave "Writing…" on the page for ever. async function recoverResourceJobs() { try { + // Kind-aware, because "Generate it again" is the wrong instruction for a + // modification: generating makes a new resource, it does not retry the edit + // the person asked for. This message is the only guidance they get. var n = await db.run("UPDATE user_resource_jobs SET status = 'failed', finished_at = NOW(), " + - "error = 'The server restarted while this was being written. Generate it again.' " + + "error = CASE WHEN kind = 'refine' " + + "THEN 'The server restarted before this change was applied. Try the change again.' " + + "ELSE 'The server restarted while this was being written. Generate it again.' END " + "WHERE status IN ('queued', 'running')"); if (n && n.changes) logger.warn('[my-resources] ' + n.changes + ' job(s) were interrupted by a restart'); } catch (err) { console.error('[my-resources] job recovery:', err.message); }