Allow plugins to specify "exit" functions

This commit is contained in:
valadaptive
2023-12-17 12:26:34 -05:00
parent 4fcb7b5ea4
commit 7ae0e05946
2 changed files with 31 additions and 13 deletions

View File

@ -608,9 +608,12 @@ const setupTasks = async function () {
await loadTokenizers();
await statsEndpoint.init();
const cleanupPlugins = await loadPlugins();
const exitProcess = () => {
statsEndpoint.onExit();
process.exit();
cleanupPlugins();
};
// Set up event listeners for a graceful shutdown
@ -621,7 +624,6 @@ const setupTasks = async function () {
exitProcess();
});
await loadPlugins();
console.log('Launching...');