Skip to content

Commit

Permalink
Fix: deferred ArchiveFile checksum waiting message (#1176)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm authored Jun 22, 2024
1 parent 5ebee0c commit e0d3e21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/candidateArchiveFileHasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ export default class CandidateArchiveFileHasher extends Module {
await this.progressBar.setSymbol(ProgressBarSymbol.HASHING);
await this.progressBar.reset(archiveFileCount);

const hashedParentsToCandidates = this.hashArchiveFiles(parentsToCandidates);
const hashedParentsToCandidates = this.hashArchiveFiles(dat, parentsToCandidates);

this.progressBar.logTrace(`${dat.getNameShort()}: done generating hashed ArchiveFile candidates`);
return hashedParentsToCandidates;
}

private async hashArchiveFiles(
dat: DAT,
parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
): Promise<Map<Parent, ReleaseCandidate[]>> {
return new Map((await Promise.all([...parentsToCandidates.entries()]
Expand All @@ -85,6 +86,7 @@ export default class CandidateArchiveFileHasher extends Module {
await this.progressBar.incrementProgress();
const waitingMessage = `${inputFile.toString()} ...`;
this.progressBar.addWaitingMessage(waitingMessage);
this.progressBar.logTrace(`${dat.getNameShort()}: ${parent.getName()}: calculating checksums for: ${inputFile.toString()}`);

const hashedInputFile = await FileFactory.archiveFileFrom(
inputFile.getArchive(),
Expand All @@ -105,7 +107,7 @@ export default class CandidateArchiveFileHasher extends Module {
hashedOutputFile,
);

this.progressBar.removeWaitingMessage('');
this.progressBar.removeWaitingMessage(waitingMessage);
await this.progressBar.incrementDone();
return hashedRomWithFiles;
});
Expand Down

0 comments on commit e0d3e21

Please sign in to comment.