Extract tx resend intervals in env variables (#532)
This commit is contained in:
parent
818bc4675d
commit
4dba9a50e8
@ -42,6 +42,8 @@ ORACLE_HOME_TO_FOREIGN_BLOCK_LIST | Filename with a list of addresses, separated
|
|||||||
ORACLE_HOME_TO_FOREIGN_CHECK_SENDER | If set to `true`, instructs the oracle to do an extra check for transaction origin in the block/allowance list. `false` by default. | `true` / `false`
|
ORACLE_HOME_TO_FOREIGN_CHECK_SENDER | If set to `true`, instructs the oracle to do an extra check for transaction origin in the block/allowance list. `false` by default. | `true` / `false`
|
||||||
ORACLE_ALWAYS_RELAY_SIGNATURES | If set to `true`, the oracle will always relay signatures even if it was not the last who finilized the signatures collecting process. The default is `false`. | `true` / `false`
|
ORACLE_ALWAYS_RELAY_SIGNATURES | If set to `true`, the oracle will always relay signatures even if it was not the last who finilized the signatures collecting process. The default is `false`. | `true` / `false`
|
||||||
ORACLE_RPC_REQUEST_TIMEOUT | Timeout in milliseconds for a single RPC request. Default value is `ORACLE_*_RPC_POLLING_INTERVAL * 2`. | integer
|
ORACLE_RPC_REQUEST_TIMEOUT | Timeout in milliseconds for a single RPC request. Default value is `ORACLE_*_RPC_POLLING_INTERVAL * 2`. | integer
|
||||||
|
ORACLE_HOME_TX_RESEND_INTERVAL | Interval in milliseconds for automatic resending of stuck transactions for Home sender service. Defaults to 20 minutes. | integer
|
||||||
|
ORACLE_FOREIGN_TX_RESEND_INTERVAL | Interval in milliseconds for automatic resending of stuck transactions for Foreign sender service. Defaults to 20 minutes. | integer
|
||||||
|
|
||||||
|
|
||||||
## UI configuration
|
## UI configuration
|
||||||
|
@ -14,12 +14,14 @@ COMMON_HOME_GAS_PRICE_SPEED_TYPE=standard
|
|||||||
COMMON_HOME_GAS_PRICE_FALLBACK=1000000000
|
COMMON_HOME_GAS_PRICE_FALLBACK=1000000000
|
||||||
ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL=600000
|
ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL=600000
|
||||||
COMMON_HOME_GAS_PRICE_FACTOR=1
|
COMMON_HOME_GAS_PRICE_FACTOR=1
|
||||||
|
ORACLE_HOME_TX_RESEND_INTERVAL=300000
|
||||||
|
|
||||||
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
|
COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/
|
||||||
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
|
COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
|
||||||
COMMON_FOREIGN_GAS_PRICE_FALLBACK=1000000000
|
COMMON_FOREIGN_GAS_PRICE_FALLBACK=1000000000
|
||||||
ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000
|
ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000
|
||||||
COMMON_FOREIGN_GAS_PRICE_FACTOR=1
|
COMMON_FOREIGN_GAS_PRICE_FACTOR=1
|
||||||
|
ORACLE_FOREIGN_TX_RESEND_INTERVAL=1200000
|
||||||
|
|
||||||
ORACLE_QUEUE_URL=amqp://rabbit
|
ORACLE_QUEUE_URL=amqp://rabbit
|
||||||
ORACLE_REDIS_URL=redis://redis
|
ORACLE_REDIS_URL=redis://redis
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
const baseConfig = require('./base.config')
|
const baseConfig = require('./base.config')
|
||||||
|
|
||||||
|
const { DEFAULT_TRANSACTION_RESEND_INTERVAL } = require('../src/utils/constants')
|
||||||
const { web3Foreign, web3ForeignRedundant, web3ForeignFallback } = require('../src/services/web3')
|
const { web3Foreign, web3ForeignRedundant, web3ForeignFallback } = require('../src/services/web3')
|
||||||
|
|
||||||
|
const { ORACLE_FOREIGN_TX_RESEND_INTERVAL } = process.env
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
...baseConfig.bridgeConfig,
|
...baseConfig.bridgeConfig,
|
||||||
queue: 'foreign-prioritized',
|
queue: 'foreign-prioritized',
|
||||||
@ -10,5 +13,6 @@ module.exports = {
|
|||||||
name: 'sender-foreign',
|
name: 'sender-foreign',
|
||||||
web3: web3Foreign,
|
web3: web3Foreign,
|
||||||
web3Redundant: web3ForeignRedundant,
|
web3Redundant: web3ForeignRedundant,
|
||||||
web3Fallback: web3ForeignFallback
|
web3Fallback: web3ForeignFallback,
|
||||||
|
resendInterval: parseInt(ORACLE_FOREIGN_TX_RESEND_INTERVAL, 10) || DEFAULT_TRANSACTION_RESEND_INTERVAL
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
const baseConfig = require('./base.config')
|
const baseConfig = require('./base.config')
|
||||||
|
|
||||||
|
const { DEFAULT_TRANSACTION_RESEND_INTERVAL } = require('../src/utils/constants')
|
||||||
const { web3Home, web3HomeRedundant, web3HomeFallback } = require('../src/services/web3')
|
const { web3Home, web3HomeRedundant, web3HomeFallback } = require('../src/services/web3')
|
||||||
|
|
||||||
|
const { ORACLE_HOME_TX_RESEND_INTERVAL } = process.env
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
...baseConfig.bridgeConfig,
|
...baseConfig.bridgeConfig,
|
||||||
queue: 'home-prioritized',
|
queue: 'home-prioritized',
|
||||||
@ -10,5 +13,6 @@ module.exports = {
|
|||||||
name: 'sender-home',
|
name: 'sender-home',
|
||||||
web3: web3Home,
|
web3: web3Home,
|
||||||
web3Redundant: web3HomeRedundant,
|
web3Redundant: web3HomeRedundant,
|
||||||
web3Fallback: web3HomeFallback
|
web3Fallback: web3HomeFallback,
|
||||||
|
resendInterval: parseInt(ORACLE_HOME_TX_RESEND_INTERVAL, 10) || DEFAULT_TRANSACTION_RESEND_INTERVAL
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ async function initialize() {
|
|||||||
connectSenderToQueue({
|
connectSenderToQueue({
|
||||||
queueName: config.queue,
|
queueName: config.queue,
|
||||||
oldQueueName: config.oldQueue,
|
oldQueueName: config.oldQueue,
|
||||||
|
resendInterval: config.resendInterval,
|
||||||
cb: options => {
|
cb: options => {
|
||||||
if (config.maxProcessingTime) {
|
if (config.maxProcessingTime) {
|
||||||
return watchdog(() => main(options), config.maxProcessingTime, () => {
|
return watchdog(() => main(options), config.maxProcessingTime, () => {
|
||||||
@ -207,7 +208,7 @@ async function main({ msg, ackMsg, nackMsg, channel, scheduleForRetry, scheduleT
|
|||||||
await scheduleForRetry(failedTx, msg.properties.headers['x-retries'])
|
await scheduleForRetry(failedTx, msg.properties.headers['x-retries'])
|
||||||
}
|
}
|
||||||
if (resendJobs.length) {
|
if (resendJobs.length) {
|
||||||
logger.info(`Sending ${resendJobs.length} Tx Delayed Resend Requests to Queue`)
|
logger.info({ delay: config.resendInterval }, `Sending ${resendJobs.length} Tx Delayed Resend Requests to Queue`)
|
||||||
await scheduleTransactionResend(resendJobs)
|
await scheduleTransactionResend(resendJobs)
|
||||||
}
|
}
|
||||||
ackMsg(msg)
|
ackMsg(msg)
|
||||||
|
@ -5,7 +5,6 @@ const connection = require('amqp-connection-manager').connect(process.env.ORACLE
|
|||||||
const logger = require('./logger')
|
const logger = require('./logger')
|
||||||
const { getRetrySequence } = require('../utils/utils')
|
const { getRetrySequence } = require('../utils/utils')
|
||||||
const {
|
const {
|
||||||
TRANSACTION_RESEND_TIMEOUT,
|
|
||||||
SENDER_QUEUE_MAX_PRIORITY,
|
SENDER_QUEUE_MAX_PRIORITY,
|
||||||
SENDER_QUEUE_SEND_PRIORITY,
|
SENDER_QUEUE_SEND_PRIORITY,
|
||||||
SENDER_QUEUE_CHECK_STATUS_PRIORITY
|
SENDER_QUEUE_CHECK_STATUS_PRIORITY
|
||||||
@ -48,7 +47,7 @@ function connectWatcherToQueue({ queueName, workerQueue, cb }) {
|
|||||||
cb({ sendToQueue, sendToWorker, channel: channelWrapper })
|
cb({ sendToQueue, sendToWorker, channel: channelWrapper })
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectSenderToQueue({ queueName, oldQueueName, cb }) {
|
function connectSenderToQueue({ queueName, oldQueueName, cb, resendInterval }) {
|
||||||
const deadLetterExchange = `${queueName}-retry`
|
const deadLetterExchange = `${queueName}-retry`
|
||||||
|
|
||||||
async function resendMessagesToNewQueue(channel) {
|
async function resendMessagesToNewQueue(channel) {
|
||||||
@ -97,7 +96,8 @@ function connectSenderToQueue({ queueName, oldQueueName, cb }) {
|
|||||||
channelWrapper,
|
channelWrapper,
|
||||||
channel,
|
channel,
|
||||||
queueName,
|
queueName,
|
||||||
deadLetterExchange
|
deadLetterExchange,
|
||||||
|
delay: resendInterval
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -164,13 +164,13 @@ async function generateRetry({ data, msgRetries, channelWrapper, channel, queueN
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateTransactionResend({ data, channelWrapper, channel, queueName, deadLetterExchange }) {
|
async function generateTransactionResend({ data, channelWrapper, channel, queueName, deadLetterExchange, delay }) {
|
||||||
const retryQueue = `${queueName}-check-tx-status`
|
const retryQueue = `${queueName}-check-tx-status-${delay}`
|
||||||
await channel.assertQueue(retryQueue, {
|
await channel.assertQueue(retryQueue, {
|
||||||
durable: true,
|
durable: true,
|
||||||
deadLetterExchange,
|
deadLetterExchange,
|
||||||
messageTtl: TRANSACTION_RESEND_TIMEOUT,
|
messageTtl: delay,
|
||||||
expires: TRANSACTION_RESEND_TIMEOUT * 10,
|
expires: delay * 10,
|
||||||
maxPriority: SENDER_QUEUE_MAX_PRIORITY
|
maxPriority: SENDER_QUEUE_MAX_PRIORITY
|
||||||
})
|
})
|
||||||
await channelWrapper.sendToQueue(retryQueue, data, {
|
await channelWrapper.sendToQueue(retryQueue, data, {
|
||||||
|
@ -23,7 +23,7 @@ module.exports = {
|
|||||||
MIN: 1,
|
MIN: 1,
|
||||||
MAX: 1000
|
MAX: 1000
|
||||||
},
|
},
|
||||||
TRANSACTION_RESEND_TIMEOUT: 20 * 60 * 1000,
|
DEFAULT_TRANSACTION_RESEND_INTERVAL: 20 * 60 * 1000,
|
||||||
FALLBACK_RPC_URL_SWITCH_TIMEOUT: 60 * 60 * 1000,
|
FALLBACK_RPC_URL_SWITCH_TIMEOUT: 60 * 60 * 1000,
|
||||||
SENDER_QUEUE_MAX_PRIORITY: 10,
|
SENDER_QUEUE_MAX_PRIORITY: 10,
|
||||||
SENDER_QUEUE_SEND_PRIORITY: 5,
|
SENDER_QUEUE_SEND_PRIORITY: 5,
|
||||||
|
Loading…
Reference in New Issue
Block a user