Browse Source

增加isJustReceivePacket

sensordb2 1 year ago
parent
commit
6b46f6dfc5
1 changed files with 10 additions and 11 deletions
  1. 10 11
      insert-app/src/main/java/db/handler/PackageHandler.java

+ 10 - 11
insert-app/src/main/java/db/handler/PackageHandler.java

@@ -219,21 +219,20 @@ public class PackageHandler {
         log.debug("开始处理探针上传的数据包:{}", dataResponsePackage);
         statisticService.incrDataCount();
 
-        if(isJustReceivePacket) {
+        if(isJustReceivePacket) return;
 
-            if (enableWal) {  // 生成 WAL 文件
-                WalItem walItem = new WalItem(dataResponsePackage.getProbeId(), dataResponsePackage.getPort(),
-                        dataResponsePackage.getDataStrategy(), dataResponsePackage.getClockSync(),
-                        dataResponsePackage.getTimestamp(), dataResponsePackage.getRawPacket());
+        if (enableWal) {  // 生成 WAL 文件
+            WalItem walItem = new WalItem(dataResponsePackage.getProbeId(), dataResponsePackage.getPort(),
+                    dataResponsePackage.getDataStrategy(), dataResponsePackage.getClockSync(),
+                    dataResponsePackage.getTimestamp(), dataResponsePackage.getRawPacket());
 
-                try {
-                    walFileService.appendWal(walItem);
-                } catch (IOException e) {
-                    log.error("添加walItem到wal文件失败,walItem:{}", walItem, e);
-                }
+            try {
+                walFileService.appendWal(walItem);
+            } catch (IOException e) {
+                log.error("添加walItem到wal文件失败,walItem:{}", walItem, e);
             }
-            addToPackageBuffer(dataResponsePackage);
         }
+        addToPackageBuffer(dataResponsePackage);
     }
 
     /**