-
Notifications
You must be signed in to change notification settings - Fork 37
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
Newparser #9
Newparser #9
Conversation
@@ -221,7 +221,7 @@ end | |||
@redisfunction "shutdown" String | |||
@redisfunction "shutdown" String option | |||
@redisfunction "slaveof" String host port | |||
@redisfunction "time" Array | |||
@redisfunction "_time" Array |
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.
I did this as a proof of concept to show that we can cast Redis output to Julia types if we need to. time
seemed like an obvious first choice.
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.
Would you mind moving this part into another pr for discussion? There's probably value in doing this, but I'd like to keep things consistent in the mean time.
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.
No worries. give me a few mins.
Phew! I think that might do it, no? |
Looks pretty good to me. Let me pull it down quickly to run the tests, then I'll merge away. Thanks for taking the time to help out on this! |
Absolutely my pleasure. I have grand plans for Redis + LightGraphs. |
Also, if you wouldn't mind tagging a new version, that way I can add this as a dependency in a project I've got going on. PS: I took the liberty of creating a PR on Redis.io to change their "clients" page to point here for the Julia client. They don't currently have anything for Julia there. |
PPS: I didn't make any changes to (or do any testing with) PubSub, so I don't know whether this impacts it. |
Sure, I'll tag the version once I merge it. I think this change might break v0.3 compatibility though. When I run the tests, ERROR: type cannot be constructed Perhaps we can just require v0.4+ or something. Thoughts? |
Ah. Yes. This is a |
Getting closer. A new one with Vector{Any} ERROR: type cannot be constructed |
Yup, this is JuliaLang/Compat.jl#105. Let me fix it. You'll want to change this once the Compat fix is in, though. |
throw exceptions instead of error
Can you retest with 0.3 now? |
Okay, pretty sure this will be the last problem we find. Subscription is broken because of this line https://github.com/jkaye2012/Redis.jl/blob/master/src/client.jl#L49 Just have to plug the new parsing in there and everything should work. This would also be broken on v0.4; after it's fixed just run a local Redis server (with data that you don't care about - it will run |
Also, this highlights another problem, which is that the Travis-CI build isn't properly running the tests right now because runtests.jl doesn't have anything in it, so I will have to fix that at some point. I'm pretty sure this commit actually breaks parser_tests.jl as well now that I think of it. |
Hah - you've just guaranteed that it won't be. :) Thanks for the testing instructions. I'd been doing Pkg.test() without realizing that runtests was empty :) |
Yeah.. it's kinda goofy because redis_tests.jl is really the one you need to know that everything is working, but it's really an integration test and not a unit test. |
OK, I'm having anxiety about pubsub here, since |
That reply was being used for the old parsing. If I'm not mistaken, subscription only uses the actual result, so you should be able to just pass the result of your new parsing into SubscriptionMessage and everything should be fine. The way it works is that the subscription sends an array response to the client. Your parsing will turn that into an array of strings, which the SubscriptionMessage will parse for use by the frontend. |
The new parser just returns an int, string, or array depending on the result of the command. There's no structure with a response attribute. |
Yeah, so you can remove the |
Ah, I got it. pubsub is always an array, with the first element being the notification type. OK. stand by... |
I kept this commit separate (unsquashed). |
tests not working: specifically,
|
Missing conn.socket as second argument here I believe: https://github.com/sbromberger/Redis.jl/commit/cec86893a3ee63234d759d7d459326d992727c4c#diff-29a732d52d0661ba454242753a687486R50 |
Gah, of course. (it's my code; I should've caught that. Sorry!) tests run now, though there are deprecation warnings, and I had a quick bugfix for an error in the script. ETA: This bug should really be fixed by importing Base.keys. |
Let's fix those in another commit. For now, this looks good on v0.3 and v0.4 so I'll go ahead and merge it once the build passes. |
Just to be clear: I fixed the test script (by changing keys to Redis.keys) in this PR. I'll follow up on merge with a "real" fix. |
Thanks. Stand by for the fix for testing script. |
See #11. BTW, thanks so much for your prompt review/feedback on this flurry of changes. :) |
This is a fix-all with a new parsing structure that takes advantage of Redis' CRLF line terminators. No more
readavailable
required, since we know when the Redis output is finished.(In particular, this includes fixes for #1, #6, #7, and #8.)