Skip to content

Commit c5a298c

Browse files
committed
fix?
1 parent 88b514e commit c5a298c

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ transcriber.js
22
test-config.json
33
public-test-config.json
44
node_modules/
5+
models/*

worker.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,19 @@ utils.events.on("error", (data) => {
7575
console.error("worker error: " + data);
7676
});
7777
if (workerData) {
78-
if (workerData.type == "command") {
79-
utils.getVideoData(workerData.query).then((videoData) => {
78+
try {
79+
if (workerData.type == "command") {
80+
const videoData = await utils.getVideoData(workerData.query)
8081
parentPort.postMessage(JSON.stringify(videoData));
81-
});
82-
} else if (workerData.type == "voiceCommand") {
83-
utils.search(workerData.query, false).then((videoData) => {
82+
} else if (workerData.type == "voiceCommand") {
83+
const videoData = await utils.search(workerData.query, false)
8484
if (videoData) {
85-
parentPort.postMessage({ type: "video", data: JSON.stringify(videoData)});
85+
parentPort.postMessage({ type: "video", data: JSON.stringify(videoData) });
8686
} else {
8787
parentPort.postMessage("false");
8888
}
89-
});
89+
}
90+
} catch(e) {
91+
console.log("worker error: ", e);
9092
}
91-
}
93+
}

0 commit comments

Comments
 (0)