merge: a restarted modification is retried, not regenerated
This commit is contained in:
commit
f3e4e6df4f
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