Skip to content

Commit

Permalink
fix(rabbitmq): dirty queue resist when no consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
tuana9a committed Aug 16, 2024
1 parent 77de953 commit ca6b247
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api-gateway/src/consumers/consume-maybe-stale-job-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { mongoConnectionPool, rabbitmqConnectionPool } from "../connections";
import logger from "../loggers/logger";

export const setup = () => {
rabbitmqConnectionPool.getChannel().assertQueue("", { autoDelete: true }, (error2, q) => {
rabbitmqConnectionPool.getChannel().assertQueue("", { exclusive: true, autoDelete: true }, (error2, q) => {
if (error2) {
logger.error(error2);
return;
Expand Down
2 changes: 1 addition & 1 deletion api-gateway/src/consumers/consume-maybe-stale-job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { rabbitmqConnectionPool } from "../connections";
import logger from "../loggers/logger";

export const setup = () => {
rabbitmqConnectionPool.getChannel().assertQueue("", { autoDelete: true }, (error2, q) => {
rabbitmqConnectionPool.getChannel().assertQueue("", { exclusive: true, autoDelete: true }, (error2, q) => {
if (error2) {
logger.error(error2);
return;
Expand Down
2 changes: 1 addition & 1 deletion api-gateway/src/consumers/consume-worker-doing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { toJson } from "../utils";

export const setup = () => {
if (cfg.LOG_WORKER_DOING) {
rabbitmqConnectionPool.getChannel().assertQueue("", { autoDelete: true }, (error2, q) => {
rabbitmqConnectionPool.getChannel().assertQueue("", { exclusive: true, autoDelete: true }, (error2, q) => {
if (error2) {
logger.error(error2);
return;
Expand Down
2 changes: 1 addition & 1 deletion api-gateway/src/consumers/consume-worker-ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { toJson } from "../utils";

export const setup = () => {
if (cfg.LOG_WORKER_PING) {
rabbitmqConnectionPool.getChannel().assertQueue("", { autoDelete: true }, (error2, q) => {
rabbitmqConnectionPool.getChannel().assertQueue("", { exclusive: true, autoDelete: true }, (error2, q) => {
if (error2) {
logger.error(error2);
return;
Expand Down

0 comments on commit ca6b247

Please sign in to comment.