refactor(core): Enforce range for shutdown priority (no-changelog) (#9944)
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import { Container } from 'typedi';
|
||||
import { ApplicationError } from 'n8n-workflow';
|
||||
import { type ServiceClass, ShutdownService } from '@/shutdown/Shutdown.service';
|
||||
|
||||
export const LOWEST_PRIORITY = 0;
|
||||
export const DEFAULT_PRIORITY = 100;
|
||||
export const HIGHEST_PRIORITY = 200;
|
||||
import { DEFAULT_SHUTDOWN_PRIORITY } from '@/constants';
|
||||
|
||||
/**
|
||||
* Decorator that registers a method as a shutdown hook. The method will
|
||||
@@ -26,7 +23,7 @@ export const HIGHEST_PRIORITY = 200;
|
||||
* ```
|
||||
*/
|
||||
export const OnShutdown =
|
||||
(priority = DEFAULT_PRIORITY): MethodDecorator =>
|
||||
(priority = DEFAULT_SHUTDOWN_PRIORITY): MethodDecorator =>
|
||||
(prototype, propertyKey, descriptor) => {
|
||||
const serviceClass = prototype.constructor as ServiceClass;
|
||||
const methodName = String(propertyKey);
|
||||
|
||||
Reference in New Issue
Block a user