-
Notifications
You must be signed in to change notification settings - Fork 1.5k
add last-delivered-id to StreamGroupInfo #1477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
mgravell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging, but I'm also going to change the code (not just yours) to not rely on position - not sure that is reliable
|
Thanks |
|
thanks I was going to have a look at the positional stuff. redis-doc does say that clients shouldn't rely on ordering. |
|
Maybe something like public static class SeqEx
{
public static RedisValue[] Get(this Sequence<RedisValue> values, params string[] names)
{
if (names.Length * 2 != values.Length)
throw new ArgumentException("values should be exactly double the length of names");
var result = new RedisValue[names.Length];
for (int i = 0; i < values.Length; i += 2)
{
if (values[i] == names[i])
result[i] = values[i + 1];
}
return result;
}
}The result will be guaranteed to be in the order of the names supplied. The nice thing would be that none of the result types need to change. It's just that the ctor calls in Just an idea :) |
|
That pretty much just retains the positional version, but at least checks
the names. I'd rather not depend on the order.
…On Sat, 30 May 2020, 14:21 Andy Pook, ***@***.***> wrote:
Maybe something like
public static class SeqEx
{
public static RedisValue[] Get(this Sequence<RedisValue> values, params string[] names)
{
if (names.Length * 2 != values.Length)
throw new ArgumentException("values should be exactly double the length of names");
var result = new RedisValue[names.Length];
for (int i = 0; i < values.Length; i += 2)
{
if (values[i] == names[i])
result[i] = values[i + 1];
}
return result;
}
}
The result will be guaranteed to be in the order of the names supplied.
Or it could be added next to the GetItems method in RawResult?
The nice thing would be that none of the result types need to change. It's
just that the ctor calls in ResultProcessor would need their indexes
changed to be sequential. A fairly big, if just tedious, change.
Just an idea :)
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1477 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMFWCPTOXEDQ4E7O25LRUEB4XANCNFSM4NNFU5TA>
.
|
|
You are right, I'm an idiot :) public static RedisValue Get(this RedisValue[] values, string name)
{
for (int i = 0; i < values.Length; i += 2)
{
if (values[i] == name)
return values[i + 1];
}
return RedisValue.EmptyString;
}
public static RedisValue[] GetValues(this RedisValue[] values, params string[] names)
{
if (names.Length * 2 != values.Length)
throw new ArgumentException("values should be exactly double the length of names");
var result = new RedisValue[names.Length];
for (int i = 0; i < values.Length; i += 2)
{
for (int j = 0; j < names.Length; j++)
{
if (names[j]!=null && values[i] == names[j])
{
result[j] = values[i + 1];
names[j] = null;
}
}
}
return result;
}Get is the obvious approach. Although redis-doc says the order is undefined, from the code, it is constant for a given release. |
|
Did you see the commit (I cross-reference it, it appears above) where I already implemented this at the ( |
|
Ahh, sorry missed that, been spending too long in AzDevOps. As all these bits are internal, I've got a hacked up method using |
|
I need to revisit a possible glitch in the mutex code before I can do that; have my hands busy with 16 other things at the moment, but: it is on my list! |
"last-delivered-id" was added to XINFO GROUPS in the 5.0 timeframe.
It can be useful as a proxy for stream lag when compared to StreamInfo,LastGeneratedId
However, the redis-doc wasn't updated (see redis/redis-doc#1318)
This PR simply adds the field to the StreamGroupInfo response.