tons of cursor-shit cleaning, finished implementing cnxId in observer
This commit is contained in:
+5
-2
@@ -27,14 +27,17 @@ export function assembleHandlers(modules) {
|
||||
})
|
||||
}
|
||||
|
||||
export function createDispatchMessage({ eventHandlers, actionRules }) {
|
||||
export function createDispatchMessage({ eventHandlers, eventRules, actionRules }) {
|
||||
return(async function dispatchMessage(redisCnx, msg, chan) {
|
||||
if(msg.action && msg.eventType) {
|
||||
console.warn(`[${redisCnx.redisId}] Message has both action and eventType on ${chan}`)
|
||||
return(false)
|
||||
}
|
||||
if(msg.action) return(dispatchActions(redisCnx, msg, chan, actionRules(redisCnx)))
|
||||
if(msg.eventType) return(dispatchEvents(redisCnx, msg, chan, eventHandlers))
|
||||
if(msg.eventType) {
|
||||
const handlers = eventRules ? eventRules(redisCnx) : eventHandlers
|
||||
return(dispatchEvents(redisCnx, msg, chan, handlers))
|
||||
}
|
||||
return(false)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user