-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(pages): Add workers in process pages #579
base: master
Are you sure you want to change the base?
Conversation
48eeb49
to
0edecd1
Compare
afedccc
to
c0d653b
Compare
@@ -116,7 +116,8 @@ export const REGEXP_INCLUDE_FILE_PATH = /(?<=[(]).+(?=[)])/g; | |||
// Regexp result: authorLogin | |||
export const REGEXP_AUTHOR = /(?<=author:\s).+(?=\r?\n)/g; | |||
|
|||
export const MIN_CHUNK_SIZE = Number(process.env.MIN_CHUNK_SIZE) || 1000; | |||
export const WORKERS_COUNT = Number(process.env.WORKERS_COUNT) || os.cpus().length - 1; | |||
export const MIN_CHUNK_SIZE = Number(process.env.MIN_CHUNK_SIZE) || 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мммм. Это зафорсит включение воркеров на большинстве существующих сборок.
Так ведь?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это скорее нижняя граница, сколько файлов попадет в один воркер, теперь это работает через пулл воркеров. Кол-во запущенных воркеров всегда будет равно WORKERS_COUNT , я чуть изменил функцию расчета чанка.
|
||
export function mapToObject<V>(map: Map<string, V>) { | ||
const obj: Record<string, V> = {}; | ||
map.forEach((value, key) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reduce
@@ -139,7 +142,9 @@ function prepareNavigationPaths(parsedToc: YfmToc, dirPath: string) { | |||
storage.set(href, parsedToc); | |||
|
|||
const navigationPath = _normalizeHref(href); | |||
navigationPaths.push(navigationPath); | |||
if (!navigationPaths.includes(navigationPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we need Set
5e1c094
to
ad84e5e
Compare
Add worker when building pages