INNER CODE UNIT · TypeScript

httpServer

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

  const httpServer = serve({ fetch: app.fetch, port, hostname: bindHost }, (info) => {
    logger.info({ port: info.port, host: bindHost }, 'IM.codes server started');
    scheduleCrons(env);
  });

  setupWebSocketUpgrade(httpServer as unknown as import('node:http').Server, env);

  // Graceful shutdown — terminate the embedding worker so it doesn't keep
  // the process alive after SIGTERM (k8s rolling restart, docker stop, etc).
  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);
  };

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…