From 0ab41568f808b2eec4bcc95263dd0809b2b3aa57 Mon Sep 17 00:00:00 2001 From: Richard Henry Date: Tue, 12 Mar 2024 12:12:18 -0700 Subject: [PATCH] Fix skip offset calculation in connection info manager This fixes the failing XREADGROUP test. When calling position() after skip(), the value does not consider the skipped elements, so we must add the number of skipped elements to the index. --- src/network/command_info_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/command_info_manager.rs b/src/network/command_info_manager.rs index a89c75d..1f11a8a 100644 --- a/src/network/command_info_manager.rs +++ b/src/network/command_info_manager.rs @@ -118,7 +118,7 @@ impl CommandInfoManager { .iter() .skip(*start_from as usize - 1) .position(|arg| arg.as_slice() == keyword.as_bytes()) - .map(|i| i + 1) + .map(|i| i + *start_from as usize) } else { slice .iter()