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

Crash in feed.js on_timeout #52

Open
haberc opened this issue Sep 24, 2014 · 7 comments
Open

Crash in feed.js on_timeout #52

haberc opened this issue Sep 24, 2014 · 7 comments

Comments

@haberc
Copy link

haberc commented Sep 24, 2014

I am using nano to follow a cloudant db and my code crashes repeatedly in the follow module.
File: lib/feed.js

This line of code causes the error. Seems like self.pending.request is null.
self.emit('timeout', {elapsed_ms:elapsed_ms, heartbeat:self.heartbeat, id:self.pending.request.id()});

TypeError: Cannot call method 'id' of null
at Feed.on_timeout (C:\workspace\myApp\node_modules\nano\node_modules\follow\lib\feed.js:46
3:98)

Could this be caused by wrong usage or is it a bug within the follow module?

@jcrugzz
Copy link
Member

jcrugzz commented Sep 24, 2014

@haberc this sounds like a bug but i do not believe follow supports following changes on cloudant at the moment as they don't use numbers for ids. This is something I was talking to @jhs about the other day. We do plan to support it and we'd love the help :)

@haberc
Copy link
Author

haberc commented Sep 25, 2014

@jcrugzz it interestingly works very well with Cloudant already. Actually I am using nano to interact with my cloudant db and nano itself uses follow as a module.
https://cloudant.com/blog/using-cloudant-with-node-js

@haberc
Copy link
Author

haberc commented Sep 25, 2014

I have made a quick fix, just to see where it takes me. So far I am happy with it.
I changed:

self.emit('timeout', {elapsed_ms:elapsed_ms, heartbeat:self.heartbeat, id:self.pending.request.id()});

To:

if (self.pending.request != null){
self.emit('timeout', {elapsed_ms:elapsed_ms, heartbeat:self.heartbeat, id:self.pending.request.id()});
} else {
self.emit('timeout', {elapsed_ms:elapsed_ms, heartbeat:self.heartbeat, id:""});
}

@willholley
Copy link

I assume this will also affect CouchDB 2.0 (which inherits non-numeric sequence numbers from BigCouch)?

@voortwis
Copy link

voortwis commented Nov 6, 2014

I forked into https://github.com/voortwis/follow and added a couple of changes to support the array type of sequence response from bigcouch and using the second value as the 'since' value. I did not get to testing it properly, if any of you want to take a look and comment on it that would be nice.

@jcrugzz
Copy link
Member

jcrugzz commented Nov 6, 2014

@voortwis could you fix your editior configuration so i can actually see the changes that you made in git? All I'm seeing his tab conversion churn so its hard to pick out what you actually changed. Trying to be consistent with whatever style/file format exists :).

@voortwis
Copy link

voortwis commented Nov 6, 2014

Okay, that was indeed ugly, (ignore whitespace in my editor switched on so I didn't notice).
I committed the original version and applied the changes again.

voortwis@86ddfa3

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

No branches or pull requests

4 participants