Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rabbitmq): 🐛 Disable heartbeat, add additional try/catch #764

Merged
merged 7 commits into from
Jan 25, 2025
Merged
8 changes: 5 additions & 3 deletions src/common/service-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ import { customJSONStringify, parseError } from "../utils";
import { GasPriceService } from "../gas-price";
import { CacheFeesJob } from "../gas-price/jobs/CacheFees";
import { FlashbotsClient } from "../network/FlashbotsClient";
import { ENTRYPOINT_V6_ABI } from "@biconomy/gas-estimations";
import { ENTRYPOINT_V7_ABI } from "@biconomy/gas-estimations";
import { ENTRYPOINT_V6_ABI, ENTRYPOINT_V7_ABI } from "@biconomy/gas-estimations"

const log = logger.child({
module: module.filename.split("/").slice(-4).join("/"),
Expand Down Expand Up @@ -109,7 +108,10 @@ let statusService: IStatusService;
const queueUrl =
process.env.BUNDLER_QUEUE_URL || nodeconfig.get<string>("queueUrl");

const rabbitMqConnection = await amqp.connect(queueUrl);
// disable heartbeat to avoid connection timeout
const rabbitMqConnection = await amqp.connect(queueUrl, {
heartbeat: 0,
});


const slackNotificationService = new SlackNotificationService(
Expand Down
7 changes: 6 additions & 1 deletion src/relayer/consumer/BundlerConsumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ export class BundlerConsumer
});

topLog.info(`BundlerConsumer.onMessageReceived`);
this.queue.ack(msg);

try {
this.queue.ack(msg);
} catch (err) {
topLog.error({ err }, `BundlerConsumer.onMessageReceived:: Error while acknowledging message`);
}

const sendTransactionWithRetry = async (): Promise<void> => {
// get active relayer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ export class EVMRetryTransactionService
"Message received from retry transaction queue",
);

this.queue.ack(msg);
try {
this.queue.ack(msg);
} catch (err) {
log.error({ err }, `EVMRetryTransactionService.onMessageReceived:: Error while acknowledging message`);
}

const {
transactionHash,
Expand Down
Loading