Browse Source

fixed task loss when priority queue is full

ehlxr 1 year ago
parent
commit
500e79927b
1 changed files with 2 additions and 1 deletions
  1. 2 1
      etl-core/src/main/java/com/tzld/crawler/etl/mq/EtlMQConsumer.java

+ 2 - 1
etl-core/src/main/java/com/tzld/crawler/etl/mq/EtlMQConsumer.java

@@ -122,7 +122,8 @@ public class EtlMQConsumer {
 
                 messages.forEach(message -> {
                     logPoolInfo();
-                    if (priorityPool.getQueue().remainingCapacity() > 0) {
+                    if (priorityPool.getQueue().size() > 10) {
+                        // if (priorityPool.getQueue().remainingCapacity() > 0) {
                         log.info("Receive message: {} from topic: {}, group: {}", message, topic, groupId);
                         CrawlerEtlParam param = JSONObject.parseObject(message.getMessageBodyString(), CrawlerEtlParam.class);
                         param.setMessageId(message.getMessageId());