Add support for non async hooks
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -39,8 +39,8 @@ class BackendLifecycleImpl {
|
||||
this.logger.info(`Running ${this.#shutdownTasks.length} shutdown tasks...`);
|
||||
await Promise.all(
|
||||
this.#shutdownTasks.map(hook =>
|
||||
hook
|
||||
.fn()
|
||||
Promise.resolve()
|
||||
.then(() => hook.fn())
|
||||
.catch(e => {
|
||||
this.logger.error(
|
||||
`Shutdown hook registered by plugin '${hook.pluginId}' failed with: ${e}`,
|
||||
|
||||
@@ -20,7 +20,7 @@ import { createServiceRef } from '../system/types';
|
||||
* @public
|
||||
**/
|
||||
export type BackendLifecycleShutdownHook = {
|
||||
fn: () => Promise<void>;
|
||||
fn: () => void | Promise<void>;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user