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
413b50b1
Commit
413b50b1
authored
Sep 07, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't pack any part archives for only 1 part archive
parent
d9679841
Pipeline
#5386
passed with stages
in 3 minutes and 37 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
console-api/src/packager/packager.service.ts
console-api/src/packager/packager.service.ts
+13
-3
console-api/src/update/update.service.ts
console-api/src/update/update.service.ts
+3
-0
No files found.
console-api/src/packager/packager.service.ts
View file @
413b50b1
...
...
@@ -138,6 +138,8 @@ export class PackagerService extends ConsoleLogger {
}
}
const
pendingPartTasks
:
ArchiveTask
[]
=
[];
// 散包
const
buckets
:
Record
<
string
,
[
FileWithHash
[],
number
]
>
=
{};
for
(
const
file
of
filesWithHash
)
{
...
...
@@ -146,7 +148,7 @@ export class PackagerService extends ConsoleLogger {
buckets
[
extname
]
??
=
[[],
0
];
const
bucket
=
buckets
[
extname
];
if
(
bucket
[
1
]
+
file
.
file
.
stats
.
size
>=
this
.
bucket_max
)
{
new
ArchiveTask
(
ArchiveType
.
Part
,
bucket
[
0
]).
addToTask
(
archive
Tasks
);
new
ArchiveTask
(
ArchiveType
.
Part
,
bucket
[
0
]).
addToTask
(
pendingPart
Tasks
);
bucket
[
0
]
=
[];
bucket
[
1
]
=
0
;
}
else
{
...
...
@@ -154,13 +156,21 @@ export class PackagerService extends ConsoleLogger {
bucket
[
1
]
+=
file
.
file
.
stats
.
size
;
}
}
else
{
new
ArchiveTask
(
ArchiveType
.
Part
,
[
file
]).
addToTask
(
archive
Tasks
);
new
ArchiveTask
(
ArchiveType
.
Part
,
[
file
]).
addToTask
(
pendingPart
Tasks
);
}
}
for
(
const
bucket
of
Object
.
values
(
buckets
))
{
if
(
bucket
[
0
].
length
)
{
new
ArchiveTask
(
ArchiveType
.
Part
,
bucket
[
0
]).
addToTask
(
archiveTasks
);
new
ArchiveTask
(
ArchiveType
.
Part
,
bucket
[
0
]).
addToTask
(
pendingPartTasks
);
}
}
if
(
pendingPartTasks
.
length
>
1
)
{
for
(
const
task
of
pendingPartTasks
)
{
task
.
addToTask
(
pendingPartTasks
);
}
}
else
{
this
.
log
(
`Skipping part archives because only 1 part archive.`
);
}
const
packages
=
await
Promise
.
all
(
archiveTasks
.
map
((
t
)
=>
this
.
archive
(
root
,
t
)));
// 这个 await 过后,checksum 和 打包上传都已经跑完了
...
...
console-api/src/update/update.service.ts
View file @
413b50b1
...
...
@@ -186,6 +186,9 @@ export class UpdateService extends ConsoleLogger {
}
private
pickArchives
(
archives
:
Archive
[],
requestedFiles
:
string
[])
{
if
(
!
archives
.
length
)
{
return
[];
}
const
aset
=
archives
.
map
((
a
)
=>
({
archive
:
a
,
files
:
new
Set
(
a
.
files
)
}));
const
result
=
new
Set
<
Archive
>
();
...
...
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