Skip to content
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

Added missing idle args in XPendingExtArgs #1750

Merged
merged 9 commits into from
May 13, 2021
Merged

Conversation

parvez0
Copy link
Contributor

@parvez0 parvez0 commented May 11, 2021

Made changes to XPendingExt method for allowing the usage of idle argument if defined in XPendingExtArgs

Made changes to XPendingExt method for allowing the usage of idle argument if defined in XPendingExtArgs
@monkey92t
Copy link
Collaborator

monkey92t commented May 11, 2021

@parvez0

Hi~ this modification is wrong, you need to check the order of the parameters, redis-server does not handle it rigorously.
https://github.com/redis/redis/blob/3d56be3788a68d81ddb259197b0b2f4149bd94cb/src/t_stream.c#L2573-L2630

In addition, we need to complete it in the unit test

@monkey92t
Copy link
Collaborator

For the time type, time.Duration is generally used in golang to handle it.

@parvez0
Copy link
Contributor Author

parvez0 commented May 11, 2021

What is the command for running test and also which platform is it supported by make test. If you can point me to a developer guide that will be great. As for those changes I'll do it thanks for the clarification

@monkey92t
Copy link
Collaborator

@parvez0
Copy link
Contributor Author

parvez0 commented May 11, 2021

I have updated the pull request can you verify it also I think for the first time I'll need the approval to run workflows

@monkey92t
Copy link
Collaborator

According to the redis documentation, the unit of idle is milliseconds, not nanoseconds

@parvez0
Copy link
Contributor Author

parvez0 commented May 11, 2021

I have looked at the MinRetryBackoff and other fields there is no conversion which is happening for time. Duration if specified I thought the developer has to take care of that setting so should I change it so that at the time of adding it should convert it to millisec

@parvez0
Copy link
Contributor Author

parvez0 commented May 12, 2021

@monkey92t can you verify the changes now

commands.go Outdated
args = append(args, "xpending", a.Stream, a.Group, a.Start, a.End, a.Count)
args = append(args, "xpending", a.Stream, a.Group)
if a.Idle != 0 {
args = append(args, "idle", a.Idle * time.Millisecond)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be: args = append(args, "idle", formatMs(ctx, a.Idle))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatMs should be a new function right where should it go I mean in which file

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commands_test.go Outdated
@@ -4229,6 +4229,7 @@ var _ = Describe("Commands", func() {
infoExt, err := client.XPendingExt(ctx, &redis.XPendingExtArgs{
Stream: "stream",
Group: "group",
Idle: time.Duration(0),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can add an effective idle test, it will be good

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I'll write a separate test case for Idle time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monkey92t sorry for bugging you, I have written the test case but in order to verify it I have to add a simple time.Sleep in between of the test cases and I am not sure if that is the right way to do it. I just wanted to confirm once

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

			// sleeping for 2 millisecond to test for idle time
			time.Sleep(5 * time.Millisecond)
			infoExt, err = client.XPendingExt(ctx, &redis.XPendingExtArgs{
                                     // other fields
				Idle:     2 * time.Millisecond,
			}).Result()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also there are some linting errors from my previous commit which is breaking the checks on mine can you tell what should I do about that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need to set a large enough time to prove the normal execution of the idle parameter.
500 milliseconds is too short, it is easy to make mistakes

args.Idle = 72 * time.Hour
infoExt, err = client.XPendingExt(ctx, args).Result()
Expect(err).NotTo(HaveOccurred())
Expect(infoExt).To(HaveLen(0))

parvez0 and others added 6 commits May 12, 2021 19:24
Made changes to XPendingExt method for allowing the usage of idle argument if defined in XPendingExtArgs

Fixed args order for XPending idle time

Converting idle duration to milli second before passing as an argument

Added separate test case for XPending with idle time

Fixed comment message

Added missing Idle arg in XPendingExtArgs
Changed XPendingExt method to use Idle time
Added test case for XPendingExt method
Signed-off-by: monkey <golang@88.com>
Signed-off-by: monkey <golang@88.com>
@monkey92t
Copy link
Collaborator

Fixed #1749

@jalmeter
Copy link

@monkey92t - Do you have a guess for when this will be released?

@vmihailenco
Copy link
Collaborator

I've pushed v8.8.3

monkey92t added a commit that referenced this pull request May 19, 2021
* Added missing idle args in XPendingExtArgs (#1750)

Added missing idle args in XPendingExtArgs

* fix #1754 (#1756)

* Replace go-pg with bun

* fix #1755

Signed-off-by: monkey <golang@88.com>

* fix read data

Signed-off-by: monkey <golang@88.com>

* fix #1758 (#1759)

fix #1758

Co-authored-by: Parvez <syedparvez72@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants