Skip to content

Commit

Permalink
fix(rabbitmq): 🐛 Disable heartbeat, add additional try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDivic committed Jan 24, 2025
1 parent 6ce29ac commit ae47a2d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
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

0 comments on commit ae47a2d

Please sign in to comment.