You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ke...@apache.org on 2024/07/28 18:42:17 UTC

(tinkerpop) branch poc-bulkset-result updated: uniqueSize() to reduce iteration

This is an automated email from the ASF dual-hosted git repository.

kenhuuu pushed a commit to branch poc-bulkset-result
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/poc-bulkset-result by this push:
     new b0cdeb64b1 uniqueSize() to reduce iteration
b0cdeb64b1 is described below

commit b0cdeb64b12a405da66823fb78be7a67a5599395
Author: Ken Hu <10...@users.noreply.github.com>
AuthorDate: Sun Jul 28 11:42:06 2024 -0700

    uniqueSize() to reduce iteration
---
 .../tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
index c7557ae70e..9cdc4fb746 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
@@ -421,7 +421,7 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler<Requ
             // this could be placed inside the isWriteable() portion of the if-then below but it seems better to
             // allow iteration to continue into a batch if that is possible rather than just doing nothing at all
             // while waiting for the client to catch up
-            if (aggregate.size() < resultIterationBatchSize && itty.hasNext()) aggregate.add(itty.next());
+            if (aggregate.uniqueSize() < resultIterationBatchSize && itty.hasNext()) aggregate.add(itty.next());
 
             // Don't keep executor busy if client has already given up; there is no way to catch up if the channel is
             // not active, and hence we should break the loop.
@@ -438,7 +438,7 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler<Requ
             // already given up on these requests. This leads to these executors waiting for the client to consume
             // results till the timeout. checking for isActive() should help prevent that.
             if (nettyContext.channel().isActive() && nettyContext.channel().isWritable()) {
-                if (aggregate.size() == resultIterationBatchSize || !itty.hasNext()) {
+                if (aggregate.uniqueSize() == resultIterationBatchSize || !itty.hasNext()) {
                     ByteBuf chunk = null;
                     try {
                         chunk = makeChunk(context, msg, serializer, aggregate, itty.hasNext());