lab5: устойчивость очереди, восстановление job и права broker

This commit is contained in:
2026-11-05 04:05:07 +03:00
parent 2638e1c2c4
commit 0790599d2f
44 changed files with 1122 additions and 343 deletions
+6 -6
View File
@@ -146,18 +146,18 @@ async function main(): Promise<number> {
option(args, '--operator') ?? process.env.USER ?? 'operator';
if (!attachmentId) return usage();
const candidate = await repository.replayCandidate(attachmentId);
let sourceAvailable = true;
if (candidate && candidate.staging_key === null) {
const original = await storage.head(
storage.objectKey(attachmentId),
);
sourceAvailable = original !== null;
let sourceAvailable = false;
if (candidate) {
sourceAvailable =
candidate.staging_key !== null ||
(await storage.head(storage.objectKey(attachmentId))) !== null;
}
const result = await repository.replay(attachmentId, {
reason,
operator,
maxAttempts: config.getOrThrow('JOB_MAX_ATTEMPTS'),
sourceAvailable,
expectedStagingKey: candidate?.staging_key ?? null,
});
console.log(JSON.stringify(result));
return result.kind === 'replayed' ? 0 : 3;