Skip to content

Commit b40ef78

Browse files
author
Kenneth Shepherd
committed
Added an option to control the export concurrency to allow for low user license servers or DBs with lots of classes.
1 parent 98b721f commit b40ef78

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

Diff for: commands/export.ts

+16-10
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ import { RoutineNode } from '../explorer/models/routineNode';
99
import { config } from '../extension';
1010
import Bottleneck from 'bottleneck';
1111

12-
const limiter = new Bottleneck({
13-
maxConcurrent: 1
14-
});
15-
1612
const filesFilter = (file: any) => {
1713
if (file.cat === 'CSP' || file.name.startsWith('%') || file.name.startsWith('INFORMATION.')) {
1814
return false;
@@ -107,14 +103,24 @@ export async function exportList(files: string[]): Promise<any> {
107103
if (!files || !files.length) {
108104
vscode.window.showWarningMessage('Nothing to export');
109105
}
110-
const { atelier, folder } = config().get('export');
106+
const { atelier, folder, maxConcurrentConnections } = config().get('export');
111107

112-
const results = [];
113-
for(let i=0;i<files.length;i++) {
114-
const result = await limiter.schedule(() => exportFile(files[i], getFileName(folder, files[i], atelier)));
115-
results.push(result);
108+
if (maxConcurrentConnections > 0) {
109+
const limiter = new Bottleneck({
110+
maxConcurrent: maxConcurrentConnections
111+
});
112+
const results = [];
113+
for (let i=0;i<files.length;i++) {
114+
const result = await limiter.schedule(() => exportFile(files[i], getFileName(folder, files[i], atelier)));
115+
results.push(result);
116+
}
117+
return results;
116118
}
117-
return results;
119+
return Promise.all(
120+
files.map(file => {
121+
exportFile(file, getFileName(folder, file, atelier));
122+
})
123+
);
118124
}
119125

120126
export async function exportAll(): Promise<any> {

Diff for: package.json

+5
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,11 @@
427427
"description": "Don't update the local file on export if the content is identical to the server code",
428428
"type": "boolean",
429429
"default": false
430+
},
431+
"objectscript.export.maxConcurrentConnections": {
432+
"description": "Max Export Connections (0 = Unlimited)",
433+
"type": "number",
434+
"default": 0
430435
}
431436
}
432437
},

0 commit comments

Comments
 (0)