Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge next into master #221

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
test:
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v4.1.0
with:
license-check: true
lint: true
7 changes: 2 additions & 5 deletions .taprc
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
jsx: false
ts: false
flow: false
coverage: false
disable-coverage: true
jobs: 1
files:
- 'test/**/*.test.js'
- "test/**/*.test.js"
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ async function fastifyUnderPressure (fastify, opts) {
}

function onRequest (req, reply, next) {
const _pressureHandler = req.context.config.pressureHandler || pressureHandler
const _pressureHandler = req.routeOptions.config.pressureHandler || pressureHandler
if (checkMaxEventLoopDelay && eventLoopDelay > maxEventLoopDelay) {
handlePressure(_pressureHandler, req, reply, next, TYPE_EVENT_LOOP_DELAY, eventLoopDelay)
return
Expand Down Expand Up @@ -310,7 +310,8 @@ function now () {
}

module.exports = fp(fastifyUnderPressure, {
fastify: '4.x',
// DISABLED UNTIL FINAL fastify@5 RELEASE:
// fastify: '5.x',
name: '@fastify/under-pressure'
})
module.exports.default = fastifyUnderPressure
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
"author": "Tomas Della Vedova - @delvedor (http://delved.org)",
"license": "MIT",
"dependencies": {
"@fastify/error": "^3.0.0",
"fastify-plugin": "^4.0.0"
"@fastify/error": "^3.4.1",
"fastify-plugin": "^4.5.1"
},
"devDependencies": {
"@fastify/pre-commit": "^2.0.2",
"@types/node": "^20.1.0",
"fastify": "^4.0.0-rc.2",
"semver": "^7.3.2",
"simple-get": "^4.0.0",
"@fastify/pre-commit": "^2.1.0",
"@types/node": "^20.12.7",
"fastify": "^5.0.0-alpha.1",
"semver": "^7.6.0",
"simple-get": "^4.0.1",
"sinon": "^18.0.0",
"snazzy": "^9.0.0",
"standard": "^17.0.0",
"tap": "^16.2.0",
"standard": "^17.1.0",
"tap": "^18.7.2",
"tsd": "^0.31.0"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion test/pressurehandler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ test('event loop utilization', { skip: !isSupportedVersion }, t => {
test('event loop delay (NaN)', { skip: !isSupportedVersion }, t => {
t.plan(5)

const mockedUnderPressure = t.mock('../index', {
const mockedUnderPressure = t.mockRequire('../index', {
perf_hooks: {
monitorEventLoopDelay: () => ({
enable: () => { },
Expand Down
Loading