fix: Correctly return list length in HandleLLengthCommand
Some checks failed
Build / build (push) Failing after 1m17s
Some checks failed
Build / build (push) Failing after 1m17s
The previous implementation of `HandleLLengthCommand` was not correctly returning the list length. It was using `ListStoreWithReadLock` in a way that didn't capture the return value. This commit fixes this issue by: - Modifying `ListOperations.cs` to use the generic `ListStoreWithReadLock` method correctly, ensuring that the length of the list is returned. - Updating the XML documentation in both `artifacts/native/Firefly.xml` and `artifacts/exe/Firefly.xml` to accurately reflect that `HandleLLengthCommand` returns the length of the list.
This commit is contained in:
parent
44f6b40e79
commit
a03246a07d
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -227,6 +227,13 @@
|
|||||||
<param name="args">Command arguments containing the key</param>
|
<param name="args">Command arguments containing the key</param>
|
||||||
<returns>The popped value or nil if the list is empty</returns>
|
<returns>The popped value or nil if the list is empty</returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Firefly.Firefly.HandleLLengthCommand(System.String)">
|
||||||
|
<summary>
|
||||||
|
Handles the LLEN command which returns the length of a list.
|
||||||
|
</summary>
|
||||||
|
<param name="args">Command arguments containing the key</param>
|
||||||
|
<returns>The length of the list or 0 if the key does not exist</returns>
|
||||||
|
</member>
|
||||||
<member name="M:Firefly.Firefly.HandleLRangeCommand(System.String)">
|
<member name="M:Firefly.Firefly.HandleLRangeCommand(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
Handles the LRANGE command which returns a range of elements from a list.
|
Handles the LRANGE command which returns a range of elements from a list.
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -227,6 +227,13 @@
|
|||||||
<param name="args">Command arguments containing the key</param>
|
<param name="args">Command arguments containing the key</param>
|
||||||
<returns>The popped value or nil if the list is empty</returns>
|
<returns>The popped value or nil if the list is empty</returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Firefly.Firefly.HandleLLengthCommand(System.String)">
|
||||||
|
<summary>
|
||||||
|
Handles the LLEN command which returns the length of a list.
|
||||||
|
</summary>
|
||||||
|
<param name="args">Command arguments containing the key</param>
|
||||||
|
<returns>The length of the list or 0 if the key does not exist</returns>
|
||||||
|
</member>
|
||||||
<member name="M:Firefly.Firefly.HandleLRangeCommand(System.String)">
|
<member name="M:Firefly.Firefly.HandleLRangeCommand(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
Handles the LRANGE command which returns a range of elements from a list.
|
Handles the LRANGE command which returns a range of elements from a list.
|
||||||
|
@ -165,13 +165,9 @@ namespace Firefly
|
|||||||
}
|
}
|
||||||
|
|
||||||
string key = args.Trim();
|
string key = args.Trim();
|
||||||
int length = 0;
|
|
||||||
|
// Change to use the generic method correctly by returning the length
|
||||||
// Use helper function to safely read the list with read lock
|
int length = ListStoreWithReadLock(key, list => list.Count);
|
||||||
ListStoreWithReadLock(key, list =>
|
|
||||||
{
|
|
||||||
length = list.Count;
|
|
||||||
});
|
|
||||||
|
|
||||||
return Encoding.UTF8.GetBytes($":{length}\r\n");
|
return Encoding.UTF8.GetBytes($":{length}\r\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user