Showing
1 changed file
with
4 additions
and
2 deletions
1 | package com.yohobuy.platform.grass.service.impl; | 1 | package com.yohobuy.platform.grass.service.impl; |
2 | 2 | ||
3 | 3 | ||
4 | +import com.google.common.collect.Lists; | ||
4 | import com.yoho.core.config.ConfigReader; | 5 | import com.yoho.core.config.ConfigReader; |
5 | import com.yoho.core.rest.client.ServiceCaller; | 6 | import com.yoho.core.rest.client.ServiceCaller; |
6 | import com.yoho.service.model.sns.model.enums.GrassInboxBusinessTypeEnum; | 7 | import com.yoho.service.model.sns.model.enums.GrassInboxBusinessTypeEnum; |
@@ -95,13 +96,14 @@ public class GrassUserVirtualImpl implements IGrassVirtualService{ | @@ -95,13 +96,14 @@ public class GrassUserVirtualImpl implements IGrassVirtualService{ | ||
95 | for (GrassInBoxAddReq message : messageList) { | 96 | for (GrassInBoxAddReq message : messageList) { |
96 | l.add(message); | 97 | l.add(message); |
97 | if (l.size() % batchSize == 0) { | 98 | if (l.size() % batchSize == 0) { |
98 | - sendMessage(l); | ||
99 | - l.clear(); | 99 | + List<GrassInBoxAddReq> reqlist = Lists.newArrayList(l); |
100 | + sendMessage(reqlist); | ||
100 | try { | 101 | try { |
101 | Thread.sleep(1000); | 102 | Thread.sleep(1000); |
102 | } catch (InterruptedException e) { | 103 | } catch (InterruptedException e) { |
103 | e.printStackTrace(); | 104 | e.printStackTrace(); |
104 | } | 105 | } |
106 | + l.clear(); | ||
105 | } | 107 | } |
106 | } | 108 | } |
107 | if (CollectionUtils.isNotEmpty(l)) { | 109 | if (CollectionUtils.isNotEmpty(l)) { |
-
Please register or login to post a comment