@digicms/cms
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite
25 lines (19 loc) • 514 B
JavaScript
;
const destroyOnSignal = (strapi) => {
let signalReceived = false;
// For unknown reasons, we receive signals 2 times.
// As a temporary fix, we ignore the signals received after the first one.
const terminateStrapi = async () => {
if (!signalReceived) {
signalReceived = true;
await strapi.destroy();
process.exit();
}
};
['SIGTERM', 'SIGINT'].forEach((signal) => {
process.on(signal, terminateStrapi);
});
};
module.exports = {
destroyOnSignal,
};