Skip to content

Commit

Permalink
fix deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jsumners committed Jun 18, 2024
1 parent ffb8851 commit 0998724
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 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
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

0 comments on commit 0998724

Please sign in to comment.