diff --git a/packages/bot-strategy-runner/src/index.ts b/packages/bot-strategy-runner/src/index.ts index af3c3791ae..89ba7457fd 100644 --- a/packages/bot-strategy-runner/src/index.ts +++ b/packages/bot-strategy-runner/src/index.ts @@ -104,7 +104,7 @@ async function runStrategies(strategyRunnerConfig: strategyRunnerConfig) { message: "End of execution loop - terminating process", }); - await delay(2); // waitForLogger does not always work 100% correctly in serverless. add a delay to ensure logs are captured upstream. + await delay(5); // Set a delay to let the transports flush fully. break; } if (strategyRunnerConfig.emitRunnerLogs) diff --git a/packages/contract-notifier/index.js b/packages/contract-notifier/index.js index e5c695a3a0..7ef4078e80 100755 --- a/packages/contract-notifier/index.js +++ b/packages/contract-notifier/index.js @@ -4,7 +4,7 @@ require("dotenv").config(); const retry = require("async-retry"); // Helpers: -const { Networker, Logger, waitForLogger, delay } = require("@uma/financial-templates-lib"); +const { Networker, Logger, delay } = require("@uma/financial-templates-lib"); const { ContractNotifier } = require("./src/ContractNotifier"); @@ -65,8 +65,7 @@ async function run({ logger, pollingDelay, errorRetries, errorRetriesTimeout, no at: "ContractNotifier#index", message: "End of serverless execution loop - terminating process", }); - await waitForLogger(logger); - await delay(2); // waitForLogger does not always work 100% correctly in serverless. add a delay to ensure logs are captured upstream. + await delay(5); // Set a delay to let the transports flush fully. break; } logger.debug({ @@ -115,7 +114,7 @@ async function Poll(callback) { error: typeof error === "string" ? new Error(error) : error, notificationPath: "infrastructure-error", }); - await waitForLogger(Logger); + await delay(5); // Set a delay to let the transports flush fully. callback(error); } callback(); diff --git a/packages/disputer/index.js b/packages/disputer/index.js index 7b1ed030f2..1d6e87372b 100755 --- a/packages/disputer/index.js +++ b/packages/disputer/index.js @@ -20,7 +20,6 @@ const { Logger, Networker, delay, - waitForLogger, createReferencePriceFeedForFinancialContract, setAllowance, DSProxyManager, @@ -245,8 +244,7 @@ async function run({ // If the polling delay is set to 0 then the script will terminate the bot after one full run. if (pollingDelay === 0) { logger.debug({ at: "Disputer#index", message: "End of serverless execution loop - terminating process" }); - await waitForLogger(logger); - await delay(2); // waitForLogger does not always work 100% correctly in serverless. add a delay to ensure logs are captured upstream. + await delay(5); // Set a delay to let the transports flush fully. break; } logger.debug({ @@ -318,7 +316,7 @@ async function Poll(callback) { error: typeof error === "string" ? new Error(error) : error, notificationPath: "infrastructure-error", }); - await waitForLogger(Logger); + await delay(5); // Set a delay to let the transports flush fully. callback(error); } callback(); diff --git a/packages/funding-rate-proposer/index.js b/packages/funding-rate-proposer/index.js index 3e70f747e2..2207c27bea 100755 --- a/packages/funding-rate-proposer/index.js +++ b/packages/funding-rate-proposer/index.js @@ -5,7 +5,6 @@ const retry = require("async-retry"); const { Logger, - waitForLogger, delay, FinancialContractFactoryClient, GasEstimator, @@ -116,8 +115,8 @@ async function run({ at: "PerpetualFundingRateProposer#index", message: "End of serverless execution loop - terminating process", }); - await waitForLogger(logger); - await delay(2); // waitForLogger does not always work 100% correctly in serverless. add a delay to ensure logs are captured upstream. + + await delay(5); // Set a delay to let the transports flush fully. break; } logger.debug({ @@ -171,7 +170,7 @@ async function Poll(callback) { message: "Perpetual funding rate proposer execution error🚨", error: typeof error === "string" ? new Error(error) : error, }); - await waitForLogger(Logger); + await delay(5); // Set a delay to let the transports flush fully. callback(error); } callback(); diff --git a/packages/fx-tunnel-relayer/src/index.ts b/packages/fx-tunnel-relayer/src/index.ts index 816c3e2917..96aa188084 100644 --- a/packages/fx-tunnel-relayer/src/index.ts +++ b/packages/fx-tunnel-relayer/src/index.ts @@ -5,7 +5,7 @@ import { config } from "dotenv"; import MaticJs from "@maticnetwork/maticjs"; import { averageBlockTimeSeconds, getWeb3 } from "@uma/common"; import { getAddress, getAbi } from "@uma/contracts-node"; -import { GasEstimator, Logger, waitForLogger, delay } from "@uma/financial-templates-lib"; +import { GasEstimator, Logger, delay } from "@uma/financial-templates-lib"; import { Relayer } from "./Relayer"; import { RelayerConfig } from "./RelayerConfig"; @@ -102,8 +102,7 @@ export async function run(logger: winston.Logger, web3: Web3): Promise { at: "FxTunnelRelayer#index", message: "End of serverless execution loop - terminating process", }); - await waitForLogger(logger); - await delay(2); + await delay(5); // Set a delay to let the transports flush fully. break; } logger.debug({ diff --git a/packages/insured-bridge-relayer/src/index.ts b/packages/insured-bridge-relayer/src/index.ts index c46092a3f6..ce18e97e0f 100644 --- a/packages/insured-bridge-relayer/src/index.ts +++ b/packages/insured-bridge-relayer/src/index.ts @@ -9,7 +9,6 @@ import { getWeb3, getWeb3ByChainId, processTransactionPromiseBatch, getRetryWeb3 import { GasEstimator, Logger, - waitForLogger, delay, InsuredBridgeL1Client, InsuredBridgeL2Client, @@ -166,8 +165,7 @@ export async function run(logger: winston.Logger, l1Web3: Web3): Promise { at: "AcrossRelayer#index", message: "End of serverless execution loop - terminating process", }); - await delay(5); - await waitForLogger(logger); + await delay(5); // Set a delay to let the transports flush fully. break; } logger.debug({ diff --git a/packages/liquidator/index.js b/packages/liquidator/index.js index 703b6f649e..6d690cbfa4 100755 --- a/packages/liquidator/index.js +++ b/packages/liquidator/index.js @@ -19,7 +19,6 @@ const { Networker, Logger, createReferencePriceFeedForFinancialContract, - waitForLogger, delay, setAllowance, DSProxyManager, @@ -329,8 +328,7 @@ async function run({ // If the polling delay is set to 0 then the script will terminate the bot after one full run. if (pollingDelay === 0) { logger.debug({ at: "Liquidator#index", message: "End of serverless execution loop - terminating process" }); - await waitForLogger(logger); - await delay(2); // waitForLogger does not always work 100% correctly in serverless. add a delay to ensure logs are captured upstream. + await delay(5); // Set a delay to let the transports flush fully. break; } logger.debug({ @@ -416,7 +414,7 @@ async function Poll(callback) { error: typeof error === "string" ? new Error(error) : error, notificationPath: "infrastructure-error", }); - await waitForLogger(Logger); + await delay(5); // Set a delay to let the transports flush fully. callback(error); } callback(); diff --git a/packages/monitors/index.js b/packages/monitors/index.js index 195b17c361..02a8c85374 100755 --- a/packages/monitors/index.js +++ b/packages/monitors/index.js @@ -13,7 +13,6 @@ const { Logger, createReferencePriceFeedForFinancialContract, createTokenPriceFeedForFinancialContract, - waitForLogger, delay, multicallAddressMap, OptimisticOracleType, @@ -384,8 +383,7 @@ async function run({ // If the polling delay is set to 0 then the script will terminate the bot after one full run. if (pollingDelay === 0) { logger.debug({ at: "Monitor#index", message: "End of serverless execution loop - terminating process" }); - await waitForLogger(logger); - await delay(2); // waitForLogger does not always work 100% correctly in serverless. add a delay to ensure logs are captured upstream. + await delay(5); // Set a delay to let the transports flush fully. break; } logger.debug({ at: "Monitor#index", message: "End of execution loop - waiting polling delay" }); @@ -485,7 +483,7 @@ async function Poll(callback) { error: typeof error === "string" ? new Error(error) : error, notificationPath: "infrastructure-error", }); - await waitForLogger(Logger); + await delay(5); // Set a delay to let the transports flush fully. callback(error); } callback(); diff --git a/packages/optimistic-oracle/index.js b/packages/optimistic-oracle/index.js index 44b470b112..de3a54ddf2 100755 --- a/packages/optimistic-oracle/index.js +++ b/packages/optimistic-oracle/index.js @@ -5,7 +5,6 @@ const retry = require("async-retry"); const { Logger, - waitForLogger, delay, OptimisticOracleClient, GasEstimator, @@ -127,8 +126,7 @@ async function run({ at: "OptimisticOracle#index", message: "End of serverless execution loop - terminating process", }); - await waitForLogger(logger); - await delay(2); // waitForLogger does not always work 100% correctly in serverless. add a delay to ensure logs are captured upstream. + await delay(5); // Set a delay to let the transports flush fully. break; } logger.debug({ @@ -186,7 +184,7 @@ async function Poll(callback) { error: typeof error === "string" ? new Error(error) : error, notificationPath: "infrastructure-error", }); - await waitForLogger(Logger); + await delay(5); // Set a delay to let the transports flush fully. callback(error); } callback(); diff --git a/packages/serverless-orchestration/src/ServerlessHub.js b/packages/serverless-orchestration/src/ServerlessHub.js index 5a54c08442..f101861ee9 100644 --- a/packages/serverless-orchestration/src/ServerlessHub.js +++ b/packages/serverless-orchestration/src/ServerlessHub.js @@ -37,7 +37,7 @@ const datastore = new Datastore(); // Web3 instance to get current block numbers of polling loops. const Web3 = require("web3"); -const { delay, createNewLogger, waitForLogger } = require("@uma/financial-templates-lib"); +const { delay, createNewLogger } = require("@uma/financial-templates-lib"); let customLogger; let spokeUrl; let customNodeUrl; @@ -211,7 +211,6 @@ hub.post("/", async (req, res) => { output: { errorOutputs, validOutputs, retriedOutputs }, }); - await waitForLogger(logger); await delay(waitForLoggerDelay); // Wait a few seconds to be sure the the winston logs are processed upstream. res .status(200) @@ -256,7 +255,6 @@ hub.post("/", async (req, res) => { }); } - await waitForLogger(logger); await delay(waitForLoggerDelay); // Wait a few seconds to be sure the the winston logs are processed upstream. res.status(500).send({ message: errorOutput instanceof Error ? "A fatal error occurred in the hub" : "Some spoke calls returned errors", diff --git a/packages/trader/src/index.ts b/packages/trader/src/index.ts index afe4750f62..bd7ae92484 100755 --- a/packages/trader/src/index.ts +++ b/packages/trader/src/index.ts @@ -11,7 +11,6 @@ import { Logger, createReferencePriceFeedForFinancialContract, createTokenPriceFeedForFinancialContract, - waitForLogger, delay, DSProxyManager, } from "@uma/financial-templates-lib"; @@ -121,8 +120,7 @@ export async function run(logger: winston.Logger, web3: Web3): Promise { at: "Trader#index", message: "End of serverless execution loop - terminating process", }); - await waitForLogger(logger); - await delay(2); // waitForLogger does not always work 100% correctly in serverless. add a delay to ensure logs are captured upstream. + await delay(5); // Set a delay to let the transports flush fully. break; } logger.debug({