Add watcher idle option
This commit is contained in:
parent
ab2c0ea120
commit
8fa715089b
@ -34,5 +34,6 @@ module.exports = {
|
||||
queue: 'home',
|
||||
workerQueue: 'swap-tokens',
|
||||
name: `watcher-${id}`,
|
||||
id
|
||||
id,
|
||||
idle: initialChecks.idle
|
||||
}
|
||||
|
@ -18,7 +18,16 @@ async function initialChecks() {
|
||||
} else if (ORACLE_BRIDGE_MODE === 'ERC_TO_NATIVE') {
|
||||
const bridge = new foreignWeb3.eth.Contract(FOREIGN_ERC_TO_NATIVE_ABI, COMMON_FOREIGN_BRIDGE_ADDRESS)
|
||||
result.bridgeableTokenAddress = await bridge.methods.erc20token().call()
|
||||
result.halfDuplexTokenAddress = await bridge.methods.halfDuplexErc20token().call()
|
||||
try {
|
||||
const halfDuplexErc20tokenAddress = await bridge.methods.halfDuplexErc20token().call()
|
||||
if (halfDuplexErc20tokenAddress !== result.bridgeableTokenAddress) {
|
||||
result.halfDuplexTokenAddress = halfDuplexErc20tokenAddress
|
||||
} else {
|
||||
result.idle = true
|
||||
}
|
||||
} catch (e) {
|
||||
result.idle = true
|
||||
}
|
||||
}
|
||||
|
||||
if (ORACLE_BRIDGE_MODE === 'ERC_TO_ERC') {
|
||||
|
@ -130,6 +130,11 @@ async function getLastBlockToProcess() {
|
||||
|
||||
async function main({ sendToQueue, sendToWorker }) {
|
||||
try {
|
||||
if (config.idle) {
|
||||
logger.debug('Watcher in idle mode, skipping getting events')
|
||||
return
|
||||
}
|
||||
|
||||
const lastBlockToProcess = await getLastBlockToProcess()
|
||||
|
||||
if (lastBlockToProcess.lte(lastProcessedBlock)) {
|
||||
|
Loading…
Reference in New Issue
Block a user