Skip to content

Commit 5c827a3

Browse files
committed
docs: update
1 parent fbd13b3 commit 5c827a3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type * as core from '@contentlayer/core'
22
import type { PosixFilePath } from '@contentlayer/utils'
33
import { asMutableArray, posixFilePath } from '@contentlayer/utils'
44
import type { HasConsole } from '@contentlayer/utils/effect'
5-
import { Chunk, E, HashMap, O, Option, OT, pipe, T, These, Tp } from '@contentlayer/utils/effect'
5+
import { Chunk, E, O, Option, OT, pipe, T, These, Tp } from '@contentlayer/utils/effect'
66
import { fs } from '@contentlayer/utils/node'
77
import glob from 'fast-glob'
88
import * as os from 'node:os'

packages/@contentlayer/source-files/src/fetchData/makeCacheItemFromFilePath.worker.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { provideDummyTracing, provideJaegerTracing } from '@contentlayer/utils'
1+
import { provideJaegerTracing } from '@contentlayer/utils'
22
import { pipe, provideConsole, T } from '@contentlayer/utils/effect'
33
import type { _A, _E } from '@effect-ts/core/Utils'
44
import * as os from 'node:os'
@@ -14,6 +14,7 @@ export type Either<E, A> = Left<E, A> | Right<E, A>
1414

1515
type DTO = Either<_E<ReturnType<F>>, _A<ReturnType<F>>>
1616

17+
// TODO: generalize codec / serializing
1718
// FIXME: naming
1819
export function fromWorkerPool(): F {
1920
const cores = os.cpus().length
@@ -24,7 +25,7 @@ export function fromWorkerPool(): F {
2425
//
2526
// via https://github.com/piscinajs/piscina#queue-size
2627
maxQueue: cores ** cores,
27-
// by default, this is cores * 1.5
28+
// FIXME: on the default, (#cores * 1.5), this lead to memory issues that caused a thread panic
2829
maxThreads: cores,
2930
// FIXME: get path dynamically
3031
filename:
@@ -34,7 +35,7 @@ export function fromWorkerPool(): F {
3435
return (payload) =>
3536
pipe(
3637
// host -> worker
37-
T.succeedWith(() => JSON.stringify(payload, null, 2)),
38+
T.succeedWith(() => JSON.stringify(payload)),
3839
T.chain((value) => T.promise<string>(() => pool.run(value, { name: 'makeCacheItemFromFilePath' }))),
3940
// worker -> host
4041
T.chain((value) => T.succeedWith<DTO>(() => JSON.parse(value))),
@@ -62,6 +63,6 @@ export function makeCacheItemFromFilePath(payload: string): Promise<string> {
6263
provideConsole,
6364
provideJaegerTracing('worker'),
6465
T.runPromise,
65-
(p) => p.then((value) => JSON.stringify(value, null, 2)),
66+
(p) => p.then((value) => JSON.stringify(value)),
6667
)
6768
}

0 commit comments

Comments
 (0)