Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
console
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
console
Commits
c56eb3b5
Commit
c56eb3b5
authored
Aug 04, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean
parent
aae254ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
65 deletions
+2
-65
console-api/src/update/update.service.ts
console-api/src/update/update.service.ts
+2
-65
No files found.
console-api/src/update/update.service.ts
View file @
c56eb3b5
...
...
@@ -212,16 +212,7 @@ export class UpdateService extends ConsoleLogger {
if
(
!
requestedFiles
||
!
requestedFiles
.
length
)
{
throw
new
BlankReturnMessageDto
(
400
,
'
empty files
'
).
toException
();
}
const
build
=
await
this
.
getBuild
(
id
,
depotDto
,
version
,
(
qb
)
=>
qb
.
select
(
'
build.id
'
)
//.leftJoin('build.archives', 'archive', 'archive.role = :partRole', { partRole: ArchiveType.Part })
);
// console.log(build.archives);
//let clock = moment();
//this.log('part 1');
const
build
=
await
this
.
getBuild
(
id
,
depotDto
,
version
,
(
qb
)
=>
qb
.
select
(
'
build.id
'
));
const
tryExactArchiveQuery
=
this
.
db
.
getRepository
(
Archive
)
.
createQueryBuilder
(
'
archive
'
)
...
...
@@ -229,23 +220,6 @@ export class UpdateService extends ConsoleLogger {
.
where
(
'
archive.buildId = :buildId
'
,
{
buildId
:
build
.
id
})
.
andWhere
(
'
archive.role != :partRole
'
,
{
partRole
:
ArchiveType
.
Part
})
.
andWhere
(
'
:requestedFiles = archive.files
'
,
{
requestedFiles
})
/*.addSelect(`array(${qb
.subQuery()
.select('file.path')
.from(ArchiveFile, 'file')
.where('file.archiveId = archive.id')
.getQuery()})`, 'allFiles')
tryExactArchiveQuery
.andWhere(
`:requestedFiles = array(${tryExactArchiveQuery
.subQuery()
.select('file.path')
.from(ArchiveFile, 'file')
.where('file.archiveId = archive.id')
.getQuery()})`,
{ requestedFiles: requestedFiles }
)*/
// .orderBy('archive.size', 'ASC')
.
limit
(
1
);
const
tryExactArchives
=
await
tryExactArchiveQuery
.
getMany
();
if
(
tryExactArchives
.
length
)
{
...
...
@@ -254,22 +228,7 @@ export class UpdateService extends ConsoleLogger {
archives
:
tryExactArchives
,
};
}
//this.log(`Time used: ${moment().diff(clock, 'seconds')} s`);
/*clock = moment();
this.log('part ex');
const archiveIds: number[] = (
await this.db
.createQueryBuilder()
.select('distinct(file.archiveId)', 'archiveId')
.from(ArchiveFile, 'file')
.where('file.path = any(:requestedFiles)', { requestedFiles: requestedFiles })
.innerJoin('file.archive', 'archive')
.andWhere('archive.buildId = :buildId', { buildId: build.id })
.getRawMany()
).map((obj) => obj.archiveId);*/
//this.log(`Time used: ${moment().diff(clock, 'seconds')} s`);
//clock = moment();
//this.log('part 2');
const
allPossiblePartArchives
=
await
this
.
db
.
getRepository
(
Archive
)
.
createQueryBuilder
(
'
archive
'
)
...
...
@@ -277,29 +236,8 @@ export class UpdateService extends ConsoleLogger {
.
where
(
'
archive.buildId = :buildId
'
,
{
buildId
:
build
.
id
})
.
andWhere
(
'
archive.role = :partRole
'
,
{
partRole
:
ArchiveType
.
Part
})
.
getMany
();
//.innerJoin('archive.containingFiles', 'file')
//.andWhere('file.path = any(:requestedFiles)', { requestedFiles: requestedFiles });
/*
allPartArchivesQuery.andWhere(
`archive.id in (${allPartArchivesQuery
.subQuery()
.select('distinct(file.archiveId)')
.from(ArchiveFile, 'file')
.where('file.archiveId = any(:possibleArchiveIds)', { possibleArchiveIds: build.archives.map((a) => a.id) })
.andWhere('file.path = any(:requestedFiles)', { requestedFiles: requestedFiles })
.getQuery()})`
);
*/
//const allPartArchives = await allPartArchivesQuery.getMany();
//this.log(`Time used: ${moment().diff(clock, 'seconds')} s`);
//clock = moment();
//this.log('part 3');
const
allPartArchives
=
this
.
pickArchives
(
allPossiblePartArchives
,
requestedFiles
);
//this.log(`Time used: ${moment().diff(clock, 'seconds')} s`);
//clock = moment();
//this.log('part 4');
const
fullArchive
=
await
this
.
db
.
getRepository
(
Archive
)
.
createQueryBuilder
(
'
archive
'
)
...
...
@@ -314,7 +252,6 @@ export class UpdateService extends ConsoleLogger {
archives
=
[
fullArchive
];
}
await
this
.
mirror
.
lookForArchivesMirror
(
archives
);
//this.log(`Time used: ${moment().diff(clock, 'seconds')} s`);
return
{
cdnUrl
:
this
.
cdnUrl
,
archives
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment