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 {
maxSize?: number;
@ApiProperty({ description: '是否需要回调' })
callback?: boolean;
@ApiProperty({ description: '是否只能单例运行' })
singleton?: boolean;
constructor(identifier: string, maxSize?: number, callback?: boolean) {
this.identifier = identifier;
this.maxSize = maxSize;
this.callback = callback;
constructor(info: Partial<MiddlewareInfoDto>) {
Object.assign(this, info);
}
}
......@@ -30,7 +30,11 @@ export class JsdService extends MiddlewareService {
'JSDelivr is not configured.',
).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) {
......
......@@ -128,7 +128,12 @@ export class OneTwoThreeService extends MiddlewareService {
'ott is not configured.',
).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) {
......
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