Rocky_Mountain_Vending/.pnpm-store/v10/files/94/1aa3a0815a845e7f1e16047fd6393d41c7c2725b4818464026f5b8064fd653743390dbc542377d45c45faa8bfdcee3d8901cf16e61b56a0388912acec146ff
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

46 lines
1,006 B
Text

'use strict';
const callbacks = new Set();
let isCalled = false;
let isRegistered = false;
function exit(exit, signal) {
if (isCalled) {
return;
}
isCalled = true;
for (const callback of callbacks) {
callback();
}
if (exit === true) {
process.exit(128 + signal); // eslint-disable-line unicorn/no-process-exit
}
}
module.exports = callback => {
callbacks.add(callback);
if (!isRegistered) {
isRegistered = true;
process.once('exit', exit);
process.once('SIGINT', exit.bind(null, true, 2));
process.once('SIGTERM', exit.bind(null, true, 15));
// PM2 Cluster shutdown message. Caught to support async handlers with pm2, needed because
// explicitly calling process.exit() doesn't trigger the beforeExit event, and the exit
// event cannot support async handlers, since the event loop is never called after it.
process.on('message', message => {
if (message === 'shutdown') {
exit(true, -128);
}
});
}
return () => {
callbacks.delete(callback);
};
};