lightcouch / LightCouch

CouchDB Java API
www.lightcouch.org
Apache License 2.0
67 stars 70 forks source link

changes block in hasNext #71

Open djoly42 opened 6 years ago

djoly42 commented 6 years ago

the changes is blocked/stuck in hasnext when we lose connection despite the signal changes.stop being set to true in another thread. Can we use the stop in the "do while" condition and exit when the signal is true.

` if(!stop) { String row = ""; do { row = getReader().readLine(); } while(row.length() == 0 && !stop);

            if(!row.startsWith("{\"last_seq\":")) { 
                setNextRow(gson.fromJson(row, Row.class));
                hasNext = true;
            } 
        }`
vectro commented 5 years ago

Can we merge the change from IndabaConsultores? Or if there is an objection to that patch, I'm happy to try to address it.

It needs to be possible to call stop() from another thread and have hasNext() exit, even if there are no updates from the database. Otherwise there is no way to cleanly stop the process.

lightcouch commented 5 years ago

Thanks for bringing up the issue.

There is a near coming release that should include the fix.

Kind Regards

nasava commented 5 years ago

Any news regarding this? I am also affected.

lightcouch commented 5 years ago

A release due this weekend should address the issue. Thanks.