Commit 4f3d0016 authored by nanahira's avatar nanahira

add singleton

parent 9fd5bb06
Pipeline #17469 passed with stages
in 37 seconds
...@@ -7,10 +7,10 @@ export class MiddlewareInfoDto { ...@@ -7,10 +7,10 @@ export class MiddlewareInfoDto {
maxSize?: number; maxSize?: number;
@ApiProperty({ description: '是否需要回调' }) @ApiProperty({ description: '是否需要回调' })
callback?: boolean; callback?: boolean;
@ApiProperty({ description: '是否只能单例运行' })
singleton?: boolean;
constructor(identifier: string, maxSize?: number, callback?: boolean) { constructor(info: Partial<MiddlewareInfoDto>) {
this.identifier = identifier; Object.assign(this, info);
this.maxSize = maxSize;
this.callback = callback;
} }
} }
...@@ -30,7 +30,11 @@ export class JsdService extends MiddlewareService { ...@@ -30,7 +30,11 @@ export class JsdService extends MiddlewareService {
'JSDelivr is not configured.', 'JSDelivr is not configured.',
).toException(); ).toException();
} }
return new MiddlewareInfoDto(this.jsdIdentifier, 50 * 1024 ** 2); return new MiddlewareInfoDto({
identifier: this.jsdIdentifier,
maxSize: 50 * 1024 ** 2,
callback: false,
});
} }
async upload(urlDto: PostUrlDto) { async upload(urlDto: PostUrlDto) {
......
...@@ -128,7 +128,12 @@ export class OneTwoThreeService extends MiddlewareService { ...@@ -128,7 +128,12 @@ export class OneTwoThreeService extends MiddlewareService {
'ott is not configured.', 'ott is not configured.',
).toException(); ).toException();
} }
return new MiddlewareInfoDto(this.identifier, 100 * 1024 ** 3, true); return new MiddlewareInfoDto({
identifier: this.identifier,
maxSize: 50 * 1024 ** 3,
callback: true,
singleton: true,
});
} }
async upload(info) { async upload(info) {
......
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