@nxtedition/lib 26.0.25 → 26.0.26

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 +11 -0
  2. package/package.json +1 -1
package/app.js CHANGED
@@ -37,6 +37,7 @@ import { isTimeBetween } from './time.js'
37
37
  import makeUnderPressure from './under-pressure.js'
38
38
  import undici from '@nxtedition/undici'
39
39
  import { isPrimary } from 'node:cluster'
40
+ import { nice } from '@napi-rs/nice'
40
41
 
41
42
  export function makeApp(appConfig, onTerminate) {
42
43
  let ds
@@ -299,6 +300,16 @@ export function makeApp(appConfig, onTerminate) {
299
300
 
300
301
  let toobusy
301
302
 
303
+ if (appConfig.nice && process.platform === 'linux') {
304
+ // Increase priority to reduce latency.
305
+ try {
306
+ nice(appConfig.nice ?? -5)
307
+ logger.debug('nice succeeded')
308
+ } catch (err) {
309
+ logger.error({ err }, 'nice failed')
310
+ }
311
+ }
312
+
302
313
  if (appConfig.toobusy) {
303
314
  const resolution = appConfig.toobusy.resolution ?? 10
304
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.25",
3
+ "version": "26.0.26",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",