add parts concurrency s3
This commit is contained in:
parent
1699d39f62
commit
a2fb515b74
@ -12,6 +12,7 @@ export interface S3Config {
|
|||||||
s3SecretAccessKey: string;
|
s3SecretAccessKey: string;
|
||||||
s3BucketName: string;
|
s3BucketName: string;
|
||||||
bypassCorsLocally?: boolean;
|
bypassCorsLocally?: boolean;
|
||||||
|
partsConcurrency?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DropboxConfig {
|
export interface DropboxConfig {
|
||||||
|
|||||||
@ -585,6 +585,9 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
if (this.settings.webdav.depth === undefined) {
|
if (this.settings.webdav.depth === undefined) {
|
||||||
this.settings.webdav.depth = "auto_unknown";
|
this.settings.webdav.depth = "auto_unknown";
|
||||||
}
|
}
|
||||||
|
if (this.settings.s3.partsConcurrency === undefined) {
|
||||||
|
this.settings.s3.partsConcurrency = 20;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveSettings() {
|
async saveSettings() {
|
||||||
|
|||||||
@ -154,6 +154,7 @@ export const DEFAULT_S3_CONFIG = {
|
|||||||
s3SecretAccessKey: "",
|
s3SecretAccessKey: "",
|
||||||
s3BucketName: "",
|
s3BucketName: "",
|
||||||
bypassCorsLocally: true,
|
bypassCorsLocally: true,
|
||||||
|
partsConcurrency: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type S3ObjectType = _Object;
|
export type S3ObjectType = _Object;
|
||||||
@ -291,7 +292,7 @@ export const uploadToRemote = async (
|
|||||||
const body = new Uint8Array(remoteContent);
|
const body = new Uint8Array(remoteContent);
|
||||||
const upload = new Upload({
|
const upload = new Upload({
|
||||||
client: s3Client,
|
client: s3Client,
|
||||||
queueSize: 20, // concurrency
|
queueSize: s3Config.partsConcurrency, // concurrency
|
||||||
partSize: bytesIn5MB, // minimal 5MB by default
|
partSize: bytesIn5MB, // minimal 5MB by default
|
||||||
leavePartsOnError: false,
|
leavePartsOnError: false,
|
||||||
params: {
|
params: {
|
||||||
|
|||||||
@ -754,6 +754,30 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const partsConcurrencyDiv = s3Div.createEl("div");
|
||||||
|
new Setting(partsConcurrencyDiv)
|
||||||
|
.setName("Parts Concurrency")
|
||||||
|
.setDesc(
|
||||||
|
"Large files are split into small parts to upload in S3. How many parts do you want to upload in parallel at most?"
|
||||||
|
)
|
||||||
|
.addDropdown((dropdown) => {
|
||||||
|
dropdown.addOption("1", "1");
|
||||||
|
dropdown.addOption("2", "2");
|
||||||
|
dropdown.addOption("3", "3");
|
||||||
|
dropdown.addOption("5", "5");
|
||||||
|
dropdown.addOption("10", "10");
|
||||||
|
dropdown.addOption("15", "15");
|
||||||
|
dropdown.addOption("20", "20 (default)");
|
||||||
|
|
||||||
|
dropdown
|
||||||
|
.setValue(`${this.plugin.settings.s3.partsConcurrency}`)
|
||||||
|
.onChange(async (val) => {
|
||||||
|
const realVal = parseInt(val);
|
||||||
|
this.plugin.settings.s3.partsConcurrency = realVal;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
new Setting(s3Div)
|
new Setting(s3Div)
|
||||||
.setName("check connectivity")
|
.setName("check connectivity")
|
||||||
.setDesc("check connectivity")
|
.setDesc("check connectivity")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user