fix: a restarted modification is retried, not regenerated
recoverResourceJobs marked every interrupted job failed with "The server restarted while this was being written. Generate it again." It matches all kinds, so someone whose modification was interrupted was told to generate — which makes a new resource rather than retrying the edit they asked for, and leaves the deck they were changing unmodified. The message is the only guidance they get, so it now names the action that actually helps.
This commit is contained in:
parent
39272f17c8
commit
4448688102
1 changed files with 6 additions and 1 deletions
|
|
@ -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); }
|
||||
|
|
|
|||
Loading…
Reference in a new issue