-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial setup for concurrent workers (#46)
* Initial setup for concurrent workers * Add logs for timer * Prettier lint * Fix worker script issues and await in api * Lint * Fix worker in dev mode * Remove unneeded awaits * Lint and format * Ignore worker.js file in eslint * remove class from worker for readability --------- Co-authored-by: florianbgt <florian.bigot321@gmail.com>
- Loading branch information
1 parent
0cc7191
commit 4e01be7
Showing
9 changed files
with
163 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const path = require("path"); | ||
require("ts-node").register(); | ||
require(path.resolve(__dirname, "worker.ts")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { parentPort, workerData } from "worker_threads"; | ||
import { SplitRunner } from "./splitRunner"; | ||
import { Group } from "../dependencyManager/types"; | ||
import { File } from "./types"; | ||
|
||
const { | ||
index, | ||
group, | ||
entryPointPath, | ||
files, | ||
}: { | ||
index: number; | ||
group: Group; | ||
entryPointPath: string; | ||
files: File[]; | ||
} = workerData; | ||
|
||
(() => { | ||
const splitRunner = new SplitRunner(index, group, entryPointPath, files); | ||
const updatedFiled = splitRunner.run(); | ||
// Send updated files back to the parent | ||
parentPort?.postMessage(updatedFiled); | ||
})(); |