Skip to content

Commit 56fb416

Browse files
committed
allwo for null values in file hashes
1 parent c375256 commit 56fb416

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

queueConsumer/src/files/file-queue-processor.provider.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { Injectable, OnModuleInit } from '@nestjs/common';
1010
import { Job, Queue } from 'bull';
1111
import { InjectRepository } from '@nestjs/typeorm';
12-
import { Like, Repository } from 'typeorm';
12+
import { IsNull, Like, Repository } from 'typeorm';
1313

1414
import { convertToMcap, mcapMetaInfo } from './helper/converter';
1515
import {
@@ -152,14 +152,16 @@ export class FileQueueProcessorProvider implements OnModuleInit {
152152
}
153153

154154
const file = await this.fileRepository.findOneOrFail({
155-
where: { uuid: job.data.file_uuid },
155+
where: [
156+
{
157+
hash: IsNull(),
158+
state: FileState.OK,
159+
uuid: job.data.file_uuid,
160+
},
161+
{ hash: '', state: FileState.OK, uuid: job.data.file_uuid },
162+
],
156163
});
157164

158-
if (file.hash !== '') {
159-
logger.debug(`File ${file.filename} already has a hash`);
160-
return;
161-
}
162-
163165
const temporaryFileName = `/tmp/${file.uuid}.${file.filename.split('.').pop()}`;
164166

165167
await downloadMinioFile(

0 commit comments

Comments
 (0)