Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

under-pressure

Package Overview
Dependencies
Maintainers
14
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

under-pressure - npm Package Compare versions

Comparing version 5.7.0 to 5.8.0

1

index.js

@@ -141,2 +141,3 @@ 'use strict'

eventLoopDelay = Math.max(0, histogram.mean / 1e6 - resolution)
if (Number.isNaN(eventLoopDelay)) eventLoopDelay = Infinity
histogram.reset()

@@ -143,0 +144,0 @@ } else {

6

package.json
{
"name": "under-pressure",
"version": "5.7.0",
"version": "5.8.0",
"description": "Measure process load with automatic handling of 'Service Unavailable' plugin for Fastify.",

@@ -33,3 +33,3 @@ "main": "index.js",

"devDependencies": {
"@types/node": "^15.0.1",
"@types/node": "^16.3.1",
"fastify": "^3.0.0",

@@ -41,3 +41,3 @@ "pre-commit": "^1.2.2",

"standard": "^16.0.0",
"tap": "^15.0.3",
"tap": "^15.0.10",
"tsd": "^0.14.0",

@@ -44,0 +44,0 @@ "typescript": "^4.0.3"

@@ -237,1 +237,46 @@ 'use strict'

})
test('event loop delay (NaN)', { skip: !isSupportedVersion }, t => {
t.plan(5)
const mockedUnderPressure = t.mock('../index', {
perf_hooks: {
monitorEventLoopDelay: () => ({
enable: () => { },
reset: () => { },
mean: NaN
}),
performance: {
eventLoopUtilization: () => { }
}
}
})
const fastify = Fastify()
fastify.register(mockedUnderPressure, {
maxEventLoopDelay: 1000,
pressureHandler: (req, rep, type, value) => {
t.equal(type, underPressure.TYPE_EVENT_LOOP_DELAY)
t.equal(value, Infinity)
rep.send('B')
}
})
fastify.get('/', async (req, rep) => rep.send('A'))
fastify.listen(0, (err, address) => {
t.error(err)
fastify.server.unref()
process.nextTick(() => block(1000))
sget({
method: 'GET',
url: address
}, (err, response, body) => {
t.error(err)
t.equal(body.toString(), 'B')
fastify.close()
})
})
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc