optimiz event catcher
This commit is contained in:
parent
981067421e
commit
def646bc21
@ -27,6 +27,7 @@ export class EventBatchSvr {
|
|||||||
}
|
}
|
||||||
this.processer.set((cfg.address+cfg.topic).toLowerCase(), cfg)
|
this.processer.set((cfg.address+cfg.topic).toLowerCase(), cfg)
|
||||||
}
|
}
|
||||||
|
this.eventCfgs.sort((a, b) => a.topic.localeCompare(b.topic))
|
||||||
this.redisKey = `event_${this.chainCfg.id}`
|
this.redisKey = `event_${this.chainCfg.id}`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,10 +55,9 @@ export class EventBatchSvr {
|
|||||||
uninParams.push(_param)
|
uninParams.push(_param)
|
||||||
topicsSet = new Set()
|
topicsSet = new Set()
|
||||||
} else {
|
} else {
|
||||||
let topic = getTopics(cfg)
|
if (!topicsSet.has(cfg.topic)) {
|
||||||
if (!topicsSet.has(topic)) {
|
_param.params[0].topics.push(cfg.topic)
|
||||||
_param.params[0].topics.push(topic)
|
topicsSet.add(cfg.topic)
|
||||||
topicsSet.add(topic)
|
|
||||||
}
|
}
|
||||||
_param.params[0].address.push(cfg.address)
|
_param.params[0].address.push(cfg.address)
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ export class EventBatchSvr {
|
|||||||
toBlock: 'latest',
|
toBlock: 'latest',
|
||||||
address: [cfg.address]
|
address: [cfg.address]
|
||||||
}
|
}
|
||||||
params.topics = [getTopics(cfg)]
|
params.topics = [cfg.topic]
|
||||||
const result = {
|
const result = {
|
||||||
jsonrpc: "2.0",
|
jsonrpc: "2.0",
|
||||||
method: "eth_getLogs",
|
method: "eth_getLogs",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user