INNER CODE UNIT · TypeScript

shutdown

im4codes/imcodes · server/src/index.ts:754

  const shutdown = async (signal: string) => {
    logger.info({ signal }, 'Shutting down — closing embedding pool');
    try {
      await shutdownEmbeddingPool();
    } catch (err) {
      logger.warn({ err }, 'Embedding pool shutdown failed (non-fatal)');
    }
    process.exit(0);
  };
  process.once('SIGTERM', () => void shutdown('SIGTERM'));
  process.once('SIGINT', () => void shutdown('SIGINT'));
}

// Only start the server when run directly (not when imported by tests)
const isMain = import.meta.url === new URL(process.argv[1], 'file://').href ||
  import.meta.url === `file://${process.argv[1]}`;

if (isMain) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…