Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

[nano] Follow support? #21

Closed
jhs opened this issue Sep 20, 2011 · 5 comments
Closed

[nano] Follow support? #21

jhs opened this issue Sep 20, 2011 · 5 comments

Comments

@jhs
Copy link
Collaborator

jhs commented Sep 20, 2011

Hi, Nuno.

Is it appropriate to integrate any Follow functionality into Nano?

On the one hand, Follow also strives for simplicity and tries to mirror the request API. The other major advantage IMO is the inactivity timeout which is the only way to detect some kinds of error.

On the other hand, I am not sure if it is "feature bloat" or "mission creep" for Nano.

Do you have any thoughts about this?

@dscape
Copy link
Contributor

dscape commented Sep 20, 2011

Yes, I considered it for a while and then decided to keep it simple until a someone complained.

It can make sense both ways: Follow to use nano to simplify CouchDB access code, and nano using Follow to provide efficient changes feed support.

If you feel strongly about this and think you can do a good job at keeping the impact to a minimum send in a pull request.

Side note: You might be interested in this project from @dominictarr - I know I was :)
https://github.com/dominictarr/couch-stream

@mikeal
Copy link

mikeal commented Sep 20, 2011

for what it's worth, follow is a dependency for replicate and it's working quite well so far.

-Mikeal

On Sep 20, 2011, at September 20, 20118:51 AM, Jason Smith wrote:

Hi, Nuno.

Is it appropriate to integrate any Follow functionality into Nano?

On the one hand, Follow also strives for simplicity and tries to mirror the request API. The other major advantage IMO is the inactivity timeout which is the only way to detect some kinds of error.

On the other hand, I am not sure if it is "feature bloat" or "mission creep" for Nano.

Do you have any thoughts about this?

Reply to this email directly or view it on GitHub:
#21

@jhs
Copy link
Collaborator Author

jhs commented Sep 20, 2011

Yeah Follow is extremely robust, but unfortunately not demonstrably so because it has zero test coverage.

For months I just ran a follow stream on my laptop and workstation while WiFi would crash, DSL would crash, I put my laptop to sleep, joined public WiFi networks, used Bluetooth and USB tethering over EDGE from 9,000 miles away, etc. If I ever found a crash I would figure out why and improve the code.

Unfortunately those sorts of situations are hard to write unit tests for, e.g. you timeout and reconnect but DNS resolution is also down. Not that that is an excuse. But I in that context succumbed to the temptation to shirk the unit tests.

@jhs
Copy link
Collaborator Author

jhs commented Sep 20, 2011

Anyway, I am thinking of adding Nano support in Follow rather than the other way. Instead of giving it a string URL, you could give it a Nano DB object. From there it would pull out the info it needs. So you could write:

// given: db is a Nano DB
var follow = require("follow");
follow(db, function(er, change) {
  if(er) throw er;
  console.dir(change);
})

If that works well, maybe we can talk later about bundling follow into Nano:

db.follow(function(er, change) {
  if(er) throw er;
  console.dir(change);
})

@dscape
Copy link
Contributor

dscape commented Sep 20, 2011

Looks like a great plan for me. :)

@dscape dscape closed this as completed Feb 15, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants