-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Replication (remote->local) stops when HTTP codes other than 200/404 are returned #1175
Comments
I like it, though why are you comparing the sequence numbers like that? It seems to me like a better idea would be to check is the status is greater then 399, an error could theoretically return the correct seq and bigcouch style stuff might correctly respond with a weird code and a different seq. |
I have to admit: This comparison was in the existing code. I was wondering about this myself but haven't looked into sync enough depth yet to know why the sequence numbers are compared like this ... So instead of changing this part, I've only added code to ensure that either callback(null, ...) or callback(err) is called. |
Replication should invoke callback if it receives HTTP error codes other than 404 and 200. (Which might be returned from the DB server or from an intermediary reverse proxy). It seems that there was an oversight which could lead to HTTP 500s to otherwise trigger neither success nor err-callback behavior.
I hope that the PR is not too far from your expectations ... in terms of tests, formatting, etc. ;) |
Replication should invoke callback if it receives HTTP error codes other than 404 and 200. (Which might be returned from the DB server or from an intermediary reverse proxy). It seems that there was an oversight which could lead to HTTP 500s to otherwise trigger neither success nor err-callback behavior.
I've noticed that it seems that HTTP replication (non-continuous) stops without invoking the outside caller-specified callback if a HTTP status other than 404 or 200 is returned during the replication (sync from remote->local). This could happen for example if a reverse proxy is involved which returns a 500 while it's not yet ready.
The change below (from replicate.js) should ensure that, by default, if an err is passed to the callback from .get(), and the status is not 404, and last_seq-values are not equal, then the callback is invoked with err (instead of the current behavior, which simply drops the err and never invokes the callback at all). This allows the initial code which triggered the replication to receive this error to re-start the synchronization at a later stage.
I'll try to add the relevant tests and will then submit a PR.
Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: