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

fix: update under-pressure -> @fastify/under-pressure #550

Merged
merged 1 commit into from
Jun 10, 2022
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
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ fastify
})
```

### under-pressure
### @fastify/under-pressure

The plugin includes [under-pressure](https://github.com/fastify/under-pressure), which can be configured by providing an `underPressure` property to the plugin options.
The plugin includes [@fastify/under-pressure](https://github.com/fastify/under-pressure), which can be configured by providing an `underPressure` property to the plugin options.

Using `under-pressure` allows implementing a circuit breaker that returns an error when the health metrics are not respected.
Using `@fastify/under-pressure` allows implementing a circuit breaker that returns an error when the health metrics are not respected.
Because React server side rendering is a blocking operation for the Node.js server, returning an error to the client allows signalling that the server is under too much load.

The available options are the same as those accepted by `under-pressure`.
The available options are the same as those accepted by `@fastify/under-pressure`.

For example:

Expand All @@ -112,9 +112,9 @@ fastify.register(require('@fastify/nextjs'), {

- `underPressure` - `bool|object`

- (default) when false, `under-pressure` is not registered
- when true, `under-pressure` is registered with default options
- when it is an object, `under-pressure` is registered with the provided options
- (default) when false, `@fastify/under-pressure` is not registered
- when true, `@fastify/under-pressure` is registered with default options
- when it is an object, `@fastify/under-pressure` is registered with the provided options

## Custom properties on the request object
If you want to share custom objects (for example other fastify plugin instances - e.g. @fastify/redis) across the server/client with each page request, you can use the `onRequest` hook to add it to the request object.
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
} from 'fastify';
import type { RouteGenericInterface, RouteShorthandOptions } from 'fastify/types/route';
import { NextServer } from 'next/dist/server/next';
import underPressure from 'under-pressure';
import underPressure from '@fastify/under-pressure';

declare module 'fastify' {
type FastifyNextCallback = (
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function fastifyNext (fastify, options, next) {
if (underPressure) {
const opts = typeof underPressure === 'object' ? underPressure : Object.create(null)

fastify.register(require('under-pressure'), opts)
fastify.register(require('@fastify/under-pressure'), opts)
}

const app = Next(Object.assign({}, { dev: process.env.NODE_ENV !== 'production' }, nextOptions))
Expand Down
Loading