cloudant / java-cloudant

A Java client for Cloudant
Apache License 2.0
79 stars 68 forks source link

Fix bugs in Changes.readNextRow() for continuous changes feeds #394

Closed tomblench closed 7 years ago

tomblench commented 7 years ago

What

Fix bugs in Changes.readNextRow(). Previously it was possible for readNextRow() to hang indefinitely for continuous changes feeds.

How

Exit the while loop early if the line we read from the stream was null or contains {"last_seq":.

In theory row should never be null because the stream should block if there is no more data or send "last_seq" when we get to the end. However, it's a case worth handling so that the loop still exits even if "last_seq" isn't set.

Testing

Added mock server test changesFeedLastSeq.

Issues

Fixes #390.