Open grimborg opened 9 years ago
@grimborg thanks for bringing this up. I made this change a while ago when I felt the erroring could be a bit too aggressive since its not a fatal
case. The changes you suggested seem reasonable, I would just make it an inactive
event rather than a timeout
event. There is already a timeout
event that has different semantics currently.
Thanks for the feedback! I'll emit an inactive
event as you propose.
According to the documentation, when providing a value for
inactivity_ms
, "If no changes happen by the timeout, Follow will signal an error." But it actually callson_inactivity
, which restarts the feed (see https://github.com/iriscouch/follow/blob/master/lib/feed.js#L624-L637).In some cases it is not desirable to automatically retry the feed. In my case, for example, I have a large number of databases which I want to stop following once they have been inactive for a while.
Furthemore, the documented behaviour (emiting an error) seems somewhat confusing: the fact that there haven't been changes on a database should not be an error.
Instead, I would propose the following:
'timeout'
signal when the timeout expires.retry_after_timeout
(defaulttrue
), which determines whether the feed should be retried after a timeout.This would allow users to indicate what they want Follow to do when there is a timeout, without breaking backwards compatibility.
If you are okay with this proposal, I'll implement it and send a PR.