MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / startThread

Function startThread

scripts/useless-key-scanner.mjs:98–114  ·  view source on GitHub ↗

* @param {Map } langKeys * @param {Array } filesPath * @param {Database} database

(langKeys, filesPath, database)

Source from the content-addressed store, hash-verified

96 * @param {Database} database
97 */
98function startThread(langKeys, filesPath, database) {
99 const worker = new Worker(fileURLToPath(import.meta.url), {
100 workerData: { langKeys, filesPath }
101 });
102 return new Promise((resolve, reject) => {
103 worker.on("message", (msg) => {
104 const { type, data } = msg;
105 if (type === "key") {
106 database.keysMap.set(data, true);
107 }
108 if (type === "exit") {
109 console.log(`Thread ID: ${data} \tScan finished!`);
110 resolve(null);
111 }
112 });
113 });
114}
115
116async function mainThread() {
117 console.log("process.argv:", process.argv);

Callers 1

mainThreadFunction · 0.85

Calls 3

onMethod · 0.80
logMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected