Skip to content

Commit

Permalink
Change calculation for number of webworkers for web/desktop (#2828)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Mar 18, 2022
1 parent a0b19eb commit 2ec718d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/core/rpc/BaseRpcDriver.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { isAlive, isStateTreeNode } from 'mobx-state-tree'
import { objectFromEntries } from '../util'
import { clamp, objectFromEntries } from '../util'
import { serializeAbortSignal } from './remoteAbortSignals'
import PluginManager from '../PluginManager'
import { AnyConfigurationModel } from '../configuration/configurationSchema'
import { readConfObject } from '../configuration'
import { readConfObject, AnyConfigurationModel } from '../configuration'

export interface WorkerHandle {
status?: string
Expand Down Expand Up @@ -169,7 +168,7 @@ export default abstract class BaseRpcDriver {

const workerCount =
readConfObject(this.config, 'workerCount') ||
Math.max(1, Math.ceil((hardwareConcurrency - 2) / 3))
clamp(1, Math.max(1, hardwareConcurrency - 1), 5)

return [...new Array(workerCount)].map(() => new LazyWorker(this))
}
Expand Down

0 comments on commit 2ec718d

Please sign in to comment.