lab5: устойчивость очереди, восстановление job и права broker
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user