MCPcopy
hub / github.com/simstudioai/sim / shutdown

Function shutdown

apps/realtime/src/index.ts:104–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102 })
103
104 const shutdown = async () => {
105 logger.info('Shutting down Socket.IO server...')
106
107 try {
108 await roomManager.shutdown()
109 logger.info('RoomManager shutdown complete')
110 } catch (error) {
111 logger.error('Error during RoomManager shutdown:', error)
112 }
113
114 try {
115 await shutdownSocketIOAdapter()
116 } catch (error) {
117 logger.error('Error during Socket.IO adapter shutdown:', error)
118 }
119
120 httpServer.close(() => {
121 logger.info('Socket.IO server closed')
122 process.exit(0)
123 })
124
125 setTimeout(() => {
126 logger.error('Forced shutdown after timeout')
127 process.exit(1)
128 }, SHUTDOWN_TIMEOUT_MS)
129 }
130
131 process.on('SIGINT', shutdown)
132 process.on('SIGTERM', shutdown)

Callers

nothing calls this directly

Calls 5

shutdownSocketIOAdapterFunction · 0.90
infoMethod · 0.80
errorMethod · 0.80
shutdownMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected