Hub 2.7.1: one click is one update

Buttons are off from the click until the Hub answers (the Updates page and
every action on an install's page); the server refuses a second update for
an install with one planned or running (ALREADY_PLANNED). Test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 22:15:58 +02:00
co-authored by Claude Opus 5.5
parent 90fdde054a
commit dab6fbcff6
9 changed files with 81 additions and 21 deletions
+3
View File
@@ -757,6 +757,9 @@ async function scheduleUpdate({ deploymentIds, product: wanted = null, version,
}
for (const d of deployments) {
if (d.status !== 'live') throw fail(409, 'NOT_LIVE', `${d.shortName} isn't live (${d.status}).`);
// 2.7.1: one update at a time per install, so a second click (or a second tab) can't plan another.
const pending = await prisma.job.findFirst({ where: { deploymentId: d.id, type: 'deploy', status: { in: ['scheduled', 'queued', 'delivered'] } } });
if (pending) throw fail(409, 'ALREADY_PLANNED', `${d.shortName} already has an update ${pending.status === 'delivered' ? 'running' : `planned for ${sast(pending.notBefore)}`}. Cancel it first (its job) to plan another.`);
if (d.server.removedAt) throw fail(409, 'SERVER_REMOVED', `${d.shortName}'s server was removed.`);
if (d.install) {
// Accounts is handled below (kept, updated, or installed first); anything else must be met.