usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject usergrid git commit: buffer size fix
Date Wed, 07 Oct 2015 21:07:43 GMT
Repository: usergrid
Updated Branches:
  refs/heads/2.1-release f005aceb5 -> 79caa09d4


buffer size fix


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/79caa09d
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/79caa09d
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/79caa09d

Branch: refs/heads/2.1-release
Commit: 79caa09d49c1805e6e9379e82ce6f64cf043058d
Parents: f005ace
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Wed Oct 7 15:07:24 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Wed Oct 7 15:07:24 2015 -0600

----------------------------------------------------------------------
 .../asyncevents/AmazonAsyncEventService.java            | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/79caa09d/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
index 0d7553e..a5342ea 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
@@ -558,9 +558,14 @@ public class AmazonAsyncEventService implements AsyncEventService {
                     })
                             //this won't block our read loop, just reads and proceeds
                             .flatMap(messages ->
-                                    handleMessages(messages)
-                                        .buffer(MAX_TAKE)
+                                {
+                                    final int bufferSize = messages.size();
+                                    return handleMessages(messages)
+                                        .buffer(100, TimeUnit.MILLISECONDS, bufferSize) //TODO
how to ack multiple messages via buffer
                                         .doOnNext(messagesToAck -> {
+                                            if (messagesToAck.size() == 0) {
+                                                return;
+                                            }
                                             try {
                                                 //ack each message, but only if we didn't
error.
                                                 ack(messagesToAck);
@@ -569,7 +574,8 @@ public class AmazonAsyncEventService implements AsyncEventService {
                                                 //do not rethrow so we can process all of
them
                                             }
                                         })
-                                        .flatMap(messagesToAck -> Observable.from(messagesToAck))
+                                        .flatMap(messagesToAck -> Observable.from(messagesToAck));
+                                }
                             );
 
             //start in the background


Mime
View raw message