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

Function shutdownSocketIOAdapter

apps/realtime/src/config/socket.ts:126–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

124 * Call this during graceful shutdown.
125 */
126export async function shutdownSocketIOAdapter(): Promise<void> {
127 const closePromises: Promise<void>[] = []
128
129 if (adapterPubClient) {
130 closePromises.push(
131 adapterPubClient.quit().then(() => {
132 logger.info('Redis adapter pub client closed')
133 adapterPubClient = null
134 })
135 )
136 }
137
138 if (adapterSubClient) {
139 closePromises.push(
140 adapterSubClient.quit().then(() => {
141 logger.info('Redis adapter sub client closed')
142 adapterSubClient = null
143 })
144 )
145 }
146
147 if (closePromises.length > 0) {
148 await Promise.all(closePromises)
149 logger.info('Socket.IO Redis adapter shutdown complete')
150 }
151}

Callers 1

shutdownFunction · 0.90

Calls 2

infoMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected