andywer / andywer/threads.js

TypeScript exports issue while returning workerpools

Aperta
#417 1 commento 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
3.5k
Fork
173
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

```
Exported variable 'getWorkers' has or is using name 'WorkerPool' from external module "/home/admin/Coding/project/node_modules/threads/dist/master/pool" but cannot be named.
```

```typescript
import { cpus } from 'node:os'
import { Pool, Worker, spawn } from 'threads'
import { TWorker as TWorkerGeneral } from '../workers/general'

const getWorkers = async () => {
const cpuCores = cpus.length
const optionsPool = {
concurrency: cpuCores,
size: cpuCores,
}

const [general] = await Promise.all([
Pool(
() => spawn(new Worker('../workers/general')),
optionsPool,
),
])

return {
general,
}
}

export type TWorkers = Awaited
```

Need to export https://github.com/andywer/threads.js/blob/master/src/master/pool.ts#L114 but that needs to be your decision.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.