From 4fd34ec0f7ba880fff09afa9b8bb85a41ca0695d Mon Sep 17 00:00:00 2001
From: WangJinfeng <wjf20110627@163.com>
Date: Fri, 6 Aug 2021 18:23:29 +0800
Subject: [PATCH] update sleep 120s

---
 src/main/java/mobvista/dmp/datasource/rtdmp/ServerUtil.java | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/src/main/java/mobvista/dmp/datasource/rtdmp/ServerUtil.java b/src/main/java/mobvista/dmp/datasource/rtdmp/ServerUtil.java
index ec956e0..6ac3ea7 100644
--- a/src/main/java/mobvista/dmp/datasource/rtdmp/ServerUtil.java
+++ b/src/main/java/mobvista/dmp/datasource/rtdmp/ServerUtil.java
@@ -182,7 +182,7 @@ public class ServerUtil {
 
     public static JSONObject upload(JSONArray requestBody) {
 
-        logger.info("requestBody -->> " + requestBody);
+        logger.info("requestBody upload -->> " + requestBody);
         CloseableHttpClient client = HttpClients.createDefault();
 
         RequestConfig requestConfig = RequestConfig.custom()
@@ -216,7 +216,7 @@ public class ServerUtil {
 
     public static JSONObject update(JSONArray requestBody) {
 
-        logger.info("requestBody -->> " + requestBody);
+        logger.info("requestBody update -->> " + requestBody);
         CloseableHttpClient client = HttpClients.createDefault();
 
         RequestConfig requestConfig = RequestConfig.custom()
@@ -240,21 +240,7 @@ public class ServerUtil {
             }
             jsonObject = JSON.parseObject(result.toString());
         } catch (IOException e) {
-            try {
-                post.setConfig(requestConfig);
-                post.setEntity(new StringEntity(requestBody.toJSONString()));
-                response = client.execute(post);
-                BufferedReader rd = new BufferedReader(
-                        new InputStreamReader(response.getEntity().getContent()));
-                StringBuilder result = new StringBuilder();
-                String line;
-                while ((line = rd.readLine()) != null) {
-                    result.append(line);
-                }
-                jsonObject = JSON.parseObject(result.toString());
-            } catch (IOException ex) {
-                logger.info("IOException -->> " + ex.getMessage());
-            }
+            logger.info("IOException -->> " + e.getMessage());
         } finally {
             post.abort();
         }
@@ -297,7 +283,7 @@ public class ServerUtil {
                 result.append(line);
             }
             JSONObject jsonObject = Constants.String2JSONObject(result.toString());
-            if (!jsonObject.isEmpty() && jsonObject.containsKey("id")) {
+            if (!jsonObject.isEmpty() && jsonObject.containsKey("id") && jsonObject.getString("audience_name").equals(audienceName)) {
                 audienceId = jsonObject.getIntValue("id");
             }
         } catch (IOException e) {
--
libgit2 0.27.1