Skip to content

Commit

Permalink
feat: make check expired message interval configurable to reduce the …
Browse files Browse the repository at this point in the history
…consuming thread block time
  • Loading branch information
humkum committed Dec 4, 2024
1 parent e104c02 commit ae71ddd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume

private RPCHook rpcHook = null;

/**
* Interval to clean expired messages
*/
private long cleanExpiredMsgInterval = 15;

/**
* Default constructor.
*/
Expand Down Expand Up @@ -1002,4 +1007,12 @@ public MessageQueueListener getMessageQueueListener() {
public void setMessageQueueListener(MessageQueueListener messageQueueListener) {
this.messageQueueListener = messageQueueListener;
}

public long getCleanExpiredMsgInterval() {
return cleanExpiredMsgInterval;
}

public void setCleanExpiredMsgInterval(long cleanExpiredMsgInterval) {
this.cleanExpiredMsgInterval = cleanExpiredMsgInterval;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void run() {
}
}

}, this.defaultMQPushConsumer.getConsumeTimeout(), this.defaultMQPushConsumer.getConsumeTimeout(), TimeUnit.MINUTES);
}, this.defaultMQPushConsumer.getCleanExpiredMsgInterval(), this.defaultMQPushConsumer.getCleanExpiredMsgInterval(), TimeUnit.MINUTES);
}

public void shutdown(long awaitTerminateMillis) {
Expand Down

0 comments on commit ae71ddd

Please sign in to comment.