From c011ddabfd533853fb42c2102bf68eecd0c29a3e Mon Sep 17 00:00:00 2001
From: Garet Halliday <ghalliday@gfxlabs.io>
Date: Thu, 29 Sep 2022 16:47:11 -0500
Subject: [PATCH] fix

---
 lib/gat/gatling/client/client.go | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/lib/gat/gatling/client/client.go b/lib/gat/gatling/client/client.go
index 7258b6f6..288bca2e 100644
--- a/lib/gat/gatling/client/client.go
+++ b/lib/gat/gatling/client/client.go
@@ -574,21 +574,23 @@ func (c *Client) handle_query(ctx context.Context, q *protocol.Query) error {
 					if err != nil {
 						return err
 					}
-					lastExec = cmd.Position
+					lastExec = end
 				}
 			}
 		}
 	}
 
-	c.startRequest()
-	var err error
-	if nestDepth > 0 {
-		err = c.handle_transaction(ctx, q.Fields.Query[lastExec:])
-	} else {
-		err = c.handle_simple_query(ctx, q.Fields.Query[lastExec:])
-	}
-	if err != nil {
-		return err
+	if lastExec != len(q.Fields.Query) {
+		c.startRequest()
+		var err error
+		if nestDepth > 0 {
+			err = c.handle_transaction(ctx, q.Fields.Query[lastExec:])
+		} else {
+			err = c.handle_simple_query(ctx, q.Fields.Query[lastExec:])
+		}
+		if err != nil {
+			return err
+		}
 	}
 
 	return nil
-- 
GitLab