@vnejs/tools 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/resize/audio.js +2 -2
- package/src/resize/image.js +2 -2
- package/src/resize/utils.js +2 -1
- package/src/resize/video.js +1 -1
package/package.json
CHANGED
package/src/resize/audio.js
CHANGED
|
@@ -5,7 +5,7 @@ const { clear, ffmpeg, Semaphore } = require("./utils");
|
|
|
5
5
|
|
|
6
6
|
const gameDir = path.join(process.env.PWD, "game");
|
|
7
7
|
|
|
8
|
-
const semaphore = new Semaphore(
|
|
8
|
+
const semaphore = new Semaphore(20);
|
|
9
9
|
|
|
10
10
|
const resizeOne = async (toDirName, mediaDir, mediaTypes, quality, fromDirName, options) => {
|
|
11
11
|
const promises = [];
|
|
@@ -49,7 +49,7 @@ const resizeOne = async (toDirName, mediaDir, mediaTypes, quality, fromDirName,
|
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
for (let i = 0; i < promises.length; i++) {
|
|
52
|
-
|
|
52
|
+
semaphore.push(i, 1, promises[i]);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const resize = async (toDirName, mediaTypes, quality, fromDirName, options) => {
|
package/src/resize/image.js
CHANGED
|
@@ -6,7 +6,7 @@ const { clear, Semaphore } = require("./utils");
|
|
|
6
6
|
|
|
7
7
|
const gameDir = path.join(process.env.PWD, "game");
|
|
8
8
|
|
|
9
|
-
const semaphore = new Semaphore(
|
|
9
|
+
const semaphore = new Semaphore(20);
|
|
10
10
|
|
|
11
11
|
const resizeOne = async (toDirName, mediaDir, mediaTypes, getSizes, fromDirName, options) => {
|
|
12
12
|
const promises = [];
|
|
@@ -53,7 +53,7 @@ const resizeOne = async (toDirName, mediaDir, mediaTypes, getSizes, fromDirName,
|
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
for (let i = 0; i < promises.length; i++) {
|
|
56
|
-
|
|
56
|
+
semaphore.push(i, 1, promises[i]);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
const resize = async (toDirName, mediaTypes, getSizes, fromDirName, options) => {
|
package/src/resize/utils.js
CHANGED
|
@@ -34,7 +34,7 @@ class Semaphore {
|
|
|
34
34
|
this.maxWeight = maxWeight;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
push = (key, weight, func) => {
|
|
37
|
+
push = async (key, weight, func) => {
|
|
38
38
|
const element = this.queue[key];
|
|
39
39
|
if (element) {
|
|
40
40
|
if (element.weight > weight && !element.inProcess) Object.assign(element, { weight, func });
|
|
@@ -43,6 +43,7 @@ class Semaphore {
|
|
|
43
43
|
const obj = { key, weight, func, inProcess: false };
|
|
44
44
|
const promise = new Promise((resolve) => (obj.resolve = resolve));
|
|
45
45
|
obj.promise = promise;
|
|
46
|
+
|
|
46
47
|
this.queueSorted = [];
|
|
47
48
|
this.queue[key] = obj;
|
|
48
49
|
this.length++;
|
package/src/resize/video.js
CHANGED
|
@@ -49,7 +49,7 @@ const resizeOne = async (toDirName, mediaDir, mediaTypes, height, fromDirName, o
|
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
for (let i = 0; i < promises.length; i++) {
|
|
52
|
-
|
|
52
|
+
semaphore.push(i, 1, promises[i]);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const resize = async (toDirName, mediaTypes, height, fromDirName, options) => {
|