( pattern: string, callback: (key: string) => void, )
| 70 | } |
| 71 | |
| 72 | export function psubscribeToPublishedEvent( |
| 73 | pattern: string, |
| 74 | callback: (key: string) => void, |
| 75 | ) { |
| 76 | getRedisSub().psubscribe(pattern); |
| 77 | const pmessage = (_: unknown, pattern: string, key: string) => callback(key); |
| 78 | |
| 79 | getRedisSub().on('pmessage', pmessage); |
| 80 | |
| 81 | return () => { |
| 82 | getRedisSub().punsubscribe(pattern); |
| 83 | getRedisSub().off('pmessage', pmessage); |
| 84 | }; |
| 85 | } |
nothing calls this directly
no test coverage detected