Commit 621974e9 authored by nanahira's avatar nanahira

add limits of no gather exts

parent 5102aaae
Pipeline #12479 passed with stages
in 3 minutes and 32 seconds
...@@ -63,6 +63,7 @@ export class ArchiveTask { ...@@ -63,6 +63,7 @@ export class ArchiveTask {
export class PackagerService extends ConsoleLogger { export class PackagerService extends ConsoleLogger {
bucket_max = 10 * 1024 ** 2; bucket_max = 10 * 1024 ** 2;
bucket_enter = 1 * 1024 ** 2; bucket_enter = 1 * 1024 ** 2;
noGatherExts = new Set<string>();
packagerWorkingDirectory: string; packagerWorkingDirectory: string;
private uploadLock = new Set<string>(); private uploadLock = new Set<string>();
...@@ -77,6 +78,10 @@ export class PackagerService extends ConsoleLogger { ...@@ -77,6 +78,10 @@ export class PackagerService extends ConsoleLogger {
this.bucket_max = (parseInt(config.get('PACKAGE_BUCKET_MAX')) || 10) * 1024 ** 2; this.bucket_max = (parseInt(config.get('PACKAGE_BUCKET_MAX')) || 10) * 1024 ** 2;
this.bucket_enter = (parseInt(config.get('PACKAGE_BUCKET_ENTER')) || 1) * 1024 ** 2; this.bucket_enter = (parseInt(config.get('PACKAGE_BUCKET_ENTER')) || 1) * 1024 ** 2;
this.packagerWorkingDirectory = config.get('PACKAGE_WORKING_DIRECTORY') || os.tmpdir(); this.packagerWorkingDirectory = config.get('PACKAGE_WORKING_DIRECTORY') || os.tmpdir();
const noGatherExts = config.get('PACKAGE_NO_GATHER_EXTS');
if (noGatherExts) {
this.noGatherExts = new Set(noGatherExts.split(','));
}
} }
private async waitForLock(key: string) { private async waitForLock(key: string) {
...@@ -145,8 +150,8 @@ export class PackagerService extends ConsoleLogger { ...@@ -145,8 +150,8 @@ export class PackagerService extends ConsoleLogger {
// 散包 // 散包
const buckets: Record<string, [FileWithHash[], number]> = {}; const buckets: Record<string, [FileWithHash[], number]> = {};
for (const file of filesWithHash) { for (const file of filesWithHash) {
if (file.file.stats.size < this.bucket_enter) { const extname = path.extname(file.file.basename);
const extname = path.extname(file.file.basename); if (file.file.stats.size < this.bucket_enter && !this.noGatherExts.has(extname)) {
buckets[extname] ??= [[], 0]; buckets[extname] ??= [[], 0];
const bucket = buckets[extname]; const bucket = buckets[extname];
if (bucket[1] + file.file.stats.size >= this.bucket_max) { if (bucket[1] + file.file.stats.size >= this.bucket_max) {
......
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