Commit 0c4a6cdf authored by nanahira's avatar nanahira

update upload sequence

parent 6c89a95b
Pipeline #17481 passed with stages
in 1 minute and 21 seconds
...@@ -130,7 +130,7 @@ export class MirrorService extends ConsoleLogger implements OnApplicationBootstr ...@@ -130,7 +130,7 @@ export class MirrorService extends ConsoleLogger implements OnApplicationBootstr
private async runMirror() { private async runMirror() {
const query = this.db const query = this.db
.createQueryBuilder() .createQueryBuilder()
.select(['archive.path', 'archive.size', 'archive.hash']) .select(['archive.id', 'archive.path', 'archive.size', 'archive.hash'])
.distinctOn(['archive.path']) .distinctOn(['archive.path'])
.from(Archive, 'archive') .from(Archive, 'archive')
.where('archive.size <= :maximumMirroredSize', { maximumMirroredSize: this.maximumMirroredSize }); .where('archive.size <= :maximumMirroredSize', { maximumMirroredSize: this.maximumMirroredSize });
...@@ -138,6 +138,7 @@ export class MirrorService extends ConsoleLogger implements OnApplicationBootstr ...@@ -138,6 +138,7 @@ export class MirrorService extends ConsoleLogger implements OnApplicationBootstr
.andWhere( .andWhere(
`not exists ${query.subQuery().select('mirror.path').from(ArchiveMirror, 'mirror').where('archive.path = mirror.path').getQuery()}` `not exists ${query.subQuery().select('mirror.path').from(ArchiveMirror, 'mirror').where('archive.path = mirror.path').getQuery()}`
) )
.orderBy('archive.id', 'DESC')
.take(this.mirrorConcurrent); .take(this.mirrorConcurrent);
this.log(`Searching for archives to mirror`); this.log(`Searching for archives to mirror`);
const archives = await query.getMany(); const archives = await query.getMany();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment