INNER CODE UNIT · TypeScript
handler
tot-ra/graphql-schema-registry · src/redis/index.ts:228
const handler = async (incomingChannel, message) => {
if (incomingChannel === channel) {
await onMessage(message);
}
};
redisSubscriber.on('message', handler);
await redisSubscriber.subscribe(channel);
return async () => {
if (redisSubscriber) {
redisSubscriber.off('message', handler);
await redisSubscriber.unsubscribe(channel);
}
};
} catch (e) {
logger.error(`redis.subscribe failed for channel ${channel}`, e);
return async () => {};