Ver código fonte

fixed task loss when priority queue is full

ehlxr 1 ano atrás
pai
commit
500e79927b

+ 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());