@preventive/triage 1.0.0-alpha.59 → 1.0.0-alpha.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preventive/triage",
3
- "version": "1.0.0-alpha.59",
3
+ "version": "1.0.0-alpha.60",
4
4
  "description": "Client & relay server for triaging of automated reports",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": {
@@ -117,20 +117,19 @@ export interface BuildRequest {
117
117
  const active = new Set<string>()
118
118
  const MAX_ACTIVE_BUILDS = 1
119
119
 
120
- // What a build's worker may take of the JS heap, in MiB: what a project
121
- // producing the largest bundle a build serializes (512 MiB of JSON, the
122
- // worker's MAX_SERIALIZED_BYTES) takes to build, its tree laid out, scanned
123
- // and held in memory, its JSON written as bytes off the heap: one of about
124
- // 500 MiB of small modules builds within 1 GiB, a real tree's taking more,
125
- // with room to spare; less only where the memory the process may use, its
126
- // container's limit else the machine's, leaves less once the server keeps
127
- // SERVER_RESERVE_MIB, down to the 512 MiB a build always had. Past it, Node
120
+ // What a build's worker may take of the JS heap, in MiB: the memory the
121
+ // process may use, its container's limit else the machine's, less
122
+ // RESERVED_MIB, at least the 512 MiB a build always had. A large project's
123
+ // tree, as a React Native app's, laid out and scanned in memory, takes more
124
+ // than 2 GiB, as `stasis github-bundle` takes what Node's default heap gives
125
+ // it. What is reserved is the server's, and the worker's own beyond its heap:
126
+ // the bytes of the files it lays out, its bundle's JSON (512 MiB at most, the
127
+ // worker's MAX_SERIALIZED_BYTES) and that compressed. Past it, Node
128
128
  // terminates the worker (build-memory), not the process.
129
- const BUILD_HEAP_MIB = 2048
130
- const SERVER_RESERVE_MIB = 512
129
+ const RESERVED_MIB = 512
131
130
  const MIN_BUILD_HEAP_MIB = 512
132
131
  export function buildHeapLimitMib(memory = Math.min(process.constrainedMemory() || Infinity, totalmem())): number {
133
- return Math.min(BUILD_HEAP_MIB, Math.max(MIN_BUILD_HEAP_MIB, Math.floor(memory / 1024 ** 2) - SERVER_RESERVE_MIB))
132
+ return Math.max(MIN_BUILD_HEAP_MIB, Math.floor(memory / 1024 ** 2) - RESERVED_MIB)
134
133
  }
135
134
 
136
135
  export async function withBundleBuildLease<T>(db: BundleBuildLeaseStore, userId: string, signal: AbortSignal,