@nxtedition/lib 26.0.27 → 26.0.28

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 (2) hide show
  1. package/app.js +0 -52
  2. package/package.json +1 -2
package/app.js CHANGED
@@ -38,9 +38,6 @@ import makeUnderPressure from './under-pressure.js'
38
38
  import undici from '@nxtedition/undici'
39
39
  import { isPrimary } from 'node:cluster'
40
40
  import { nice } from '@napi-rs/nice'
41
- import path from 'node:path'
42
-
43
- import { sched_setaffinity, sched_getaffinity } from '@nxtedition/sched'
44
41
 
45
42
  export function makeApp(appConfig, onTerminate) {
46
43
  let ds
@@ -313,55 +310,6 @@ export function makeApp(appConfig, onTerminate) {
313
310
  }
314
311
  }
315
312
 
316
- if (appConfig.affinity != null && process.platform === 'linux') {
317
- try {
318
- const nodes = []
319
- for (const entry of fs.readdirSync('/sys/devices/system/node')) {
320
- if (!entry.startsWith('node')) {
321
- continue
322
- }
323
-
324
- const cpulist = fs
325
- .readFileSync(path.join('/sys/devices/system/node', entry, 'cpulist'), 'utf8')
326
- .trim()
327
- const cpus = []
328
- for (const part of cpulist.split(',')) {
329
- if (part.includes('-')) {
330
- const [start, end] = part.split('-').map(Number)
331
- for (let i = start; i <= end; i++) cpus.push(i)
332
- } else {
333
- cpus.push(Number(part))
334
- }
335
- }
336
- nodes.push(cpus)
337
- }
338
-
339
- let indices
340
- if (typeof appConfig.affinity === 'number') {
341
- indices = [appConfig.affinity]
342
- } else if (Array.isArray(appConfig.affinity)) {
343
- indices = appConfig.affinity
344
- } else {
345
- indices = [Math.floor(Math.random() * nodes.length)]
346
- }
347
-
348
- if (indices?.length > 0) {
349
- let affinity = []
350
- for (const index of indices) {
351
- affinity = fp.union(affinity, nodes[index % nodes.length])
352
- }
353
-
354
- const next = affinity
355
- const prev = sched_getaffinity(0)
356
-
357
- sched_setaffinity(0, fp.intersection(prev, next))
358
- logger.debug({ data: { prev, next, nodes, affinity } }, 'sched_setaffinity succeeded')
359
- }
360
- } catch (err) {
361
- logger.error({ err }, 'sched_setaffinity failed')
362
- }
363
- }
364
-
365
313
  if (appConfig.toobusy) {
366
314
  const resolution = appConfig.toobusy.resolution ?? 10
367
315
  const interval = appConfig.toobusy.interval ?? 500
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "26.0.27",
3
+ "version": "26.0.28",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -68,7 +68,6 @@
68
68
  "@elastic/transport": "^8.9.3",
69
69
  "@napi-rs/nice": "^1.1.1",
70
70
  "@nxtedition/nxt-undici": "^6.4.0",
71
- "@nxtedition/sched": "^1.0.1",
72
71
  "@smithy/node-http-handler": "^4.1.1",
73
72
  "acorn": "^8.15.0",
74
73
  "astring": "^1.9.0",