Closed doapp-ryanp closed 9 years ago
https://github.com/hdachev/fakeredis/blob/369ba2df36df5888cdaf23b55aacea75be7dec37/lib/connection.js#L421 is where fakeredis is throwing the error - I cant seem to tell where in your code the literal command COMMAND
is being specified. Sorry I'm not much help here, redis is a bit out of my area of expertice
Agh, how annoying. An asynchronous method using throw
.
Okay, this is an easy fix I think...
Updated on the master branch if you'd like to check? I've tried testing it on my end, and it seems to work for the main commands. Though it seems to bug out with large sets, which I'm pretty sure is a limitation of fakeredis.
I REALLY appreciate you getting on this so fast. This fixed the reported bug, however now:
nearby()
even if I remove the count
option or set it to 100
.withDistances: true
and units: "mi"
. The objects returned by nearby()
return it in meters correct? I'm cool with this, and honestly don't want to spend CPU cycles doing the conversion.So regarding the accuracy - I'm hoping that the count
bugfix will resolve this issue however, here are some of the test points that are not working correctly that should help you re-produce.
{latitude: 44.01, longitude: -92.47}
correctly returns Rochester, MN: {"name":"Rochester, MN","lat":44.0150757,"lng":-92.4775256}
{latitude: 42.7086815, longitude: -84.559032}
INCORRECTLY returns Dimondale, MI: {"name":"Dimondale, MI","lat":42.6455915,"lng":-84.6488707}
with a distance
of 10166
(which is outside of my 8046.7
radius range...). As you will see in my dataset there is a "name": "Lansing, MI",
"lat": 42.7090686,
"lng": -84.5584646,
I have emailed you my data set, as well as my full code (its simple) so you can copy/paste reproduce.
@doapp-ryanp Hey Ryan!
Glad that fixed that issue. I'll need to take some time to dig into this other issue though. I'm swamped for the next couple days, unfortunately.
If you do your initial query with miles mi
, everything will be in miles. Including the radius for search, the distances returned, etc.
Will dig into it more soon!
So I think I figured it out - you can see above that I am using accurate: true
, if I switch it to false
things work. I figured that fakeredis did not have native geo commands, so that is why I initially set it to true
. I will let you determine if this is a bug or not, if not feel free to close issue. Thanks!
FWIW count does not seem to be working, i have count
set to 10 and sometimes I get more than 10 results. Not a big deal to me though, as I just slice()
. And returned distance
is always in meters even if I specify mi
Wow, some weird things happening overall. I'll see if this is all because of fakeredis or if there's something else going on!
Thanks for this.
Hey @doapp-ryanp Could you give it a try now (from master)? Your sample code was helpful! I found some pretty horrible bugs with count and when using the accurate option and sort together.
Thanks!
That fixed it! Count and 'mi' now works as expected. I'm gonna be testing this quite a bit over the next month or so, I will report back how it goes. Thanks!
Awesome! I will publish this to npm so others can benefit. :)
Thanks for pointing out all the issues!
np, will be on the lookout for the publish
Published!
By the way, if you plan on using this in production, and the geo stuff is a big part of your app, you may want to consider using this module with real Redis 3.2 when it comes out. The native geo commands are really fast and the sorting and units stuff will save a lot of CPU cycles. It's almost 20 times faster when done by Redis, but I understand that adds a dependency, and makes the app less portable for you.
In any case, definitely let me know if you encounter any other issues moving forward.
Hmm https://www.npmjs.com/package/georedis is still listing 3.0.1 for me
That's the latest one! Is it not working as expected?
nope sorry we are good. for some reason I coulda swore i was 3.0.1 before, but I didnt notice you version bumped package.json days before publish. we are good
Yeah I held off publishing 3.0.1 till all those issues were solved.
This is a continuation of https://github.com/arjunmehta/node-geo-proximity/issues/19
First off thanks for the re-write and the sorting!
I'm using
nearby()
with fakeredis and getting the following error:From what I can tell, it looks like it is using
georadius
. Any idea if this error is coming from your code or fake redis? My hunch is the latter - and if so you know any workaround?As I mentioned in the previous issue, I have to use fakeredis because I am using AWS lambda which does not currently have access to a redis server (via elasticache). Also my data set is pretty small so would like to pay the potential performance penalty to remove another thing I have to keep Highly Available.
Any ideas?
Here is my code (roughly):