mirror of
https://github.com/directus/directus.git
synced 2026-02-13 13:45:32 -05:00
* Add release notes generator for changeset * Fix ref / user logic * Enhance logic again * Extend from shared ESM tsconfig * Rename to @directus/release-notes-generator * Make versions title a constant * Rename function * Filter out 'directus' package * Final final * Reset new pressure & random packages --------- Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
@directus/pressure
Installation
npm install @directus/pressure
Usage
Standalone
The pressure monitor is a class that can be used anywhere:
import { PressureMonitor } from '@directus/pressure';
const monitor = new PressureMonitor({
maxEventLoopUtilization: 0.8,
});
monitor.overloaded; // true | false
Express
The library also exports an express middleware that can be used to throw an Error when the pressure monitor reports overloaded:
import express from 'express';
import { handlePressure } from '@directus/pressure';
const app = express();
app.use(
handlePressure({
maxEventLoopUtilization: 0.8,
})
);