@nxtedition/lib 26.1.0 → 26.3.0

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.
Files changed (3) hide show
  1. package/app.js +2 -6
  2. package/numa.js +3 -3
  3. package/package.json +1 -1
package/app.js CHANGED
@@ -317,13 +317,9 @@ export function makeApp(appConfig, onTerminate) {
317
317
 
318
318
  let affinity = null
319
319
 
320
- if (
321
- process.platform === 'linux' &&
322
- (isMainThread || appConfig.numa != null) &&
323
- appConfig.numa !== false
324
- ) {
320
+ if (process.platform === 'linux' && appConfig.numa != null && appConfig.numa !== '') {
325
321
  let numa = appConfig.numa
326
- if (numa == null || numa === true) {
322
+ if (numa == 'auto' || numa === true) {
327
323
  numa = hashString(JSON.stringify({ serviceName, serviceModule }))
328
324
  }
329
325
 
package/numa.js CHANGED
@@ -31,12 +31,12 @@ export function setAffinity(numa) {
31
31
  throw new Error('No NUMA nodes found')
32
32
  }
33
33
 
34
- if (!Number.isInteger(numa) || numa < 0) {
34
+ const indices = Array.from(new Set([numa].flat()))
35
+ if (indices.some((x) => !Number.isInteger(x) || x < 0)) {
35
36
  throw new Error('NUMA node must be a non-negative integer')
36
37
  }
37
38
 
38
- const indices = [numa % allNodes.length]
39
- const affinity = indices.flatMap((i) => allNodes[i] ?? [])
39
+ const affinity = indices.flatMap((i) => allNodes[i % allNodes.length] ?? [])
40
40
  sched_setaffinity(0, affinity)
41
41
  return affinity
42
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "26.1.0",
3
+ "version": "26.3.0",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",