mirror of
https://github.com/tornadocash/tornado-relayer.git
synced 2025-08-15 17:40:18 -04:00
increment errors score
This commit is contained in:
parent
cfcf1c8677
commit
95c6dc23c6
8 changed files with 36 additions and 10 deletions
16
src/utils.js
16
src/utils.js
|
@ -125,6 +125,20 @@ class RelayerError extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
const logRelayerError = async (redis, e) => {
|
||||
await redis.zadd('errors', 'INCR', 1, e.message)
|
||||
}
|
||||
|
||||
const readRelayerErrors = async redis => {
|
||||
const set = await redis.zrevrange('errors', 0, -1, 'WITHSCORES')
|
||||
const errors = []
|
||||
while (set.length) {
|
||||
const [message, score] = set.splice(0, 2)
|
||||
errors.push({ message, score })
|
||||
}
|
||||
return errors
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getInstance,
|
||||
setSafeInterval,
|
||||
|
@ -140,4 +154,6 @@ module.exports = {
|
|||
BN,
|
||||
isAddress,
|
||||
RelayerError,
|
||||
logRelayerError,
|
||||
readRelayerErrors,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue