I’m working with Couchbase SDK version 2.4.6 (core 1.4.6) and tried to get a huge ViewResult (~ 600 mil keys) via the asynchronous interface:
I’m mapping the resulting rows into a Flowable of AsyncViewRows, which will be mapped into a Flowable of Strings (which are the resulting keys from the view).
I’m subscribing to that flowable to fetch corresponding Documents from couchbase. After some time I got an OutOfMemory error and figured out, that the background process of the SDK wont be blocked. Seems like all keys from the view will be loaded in memory in background and I’m not able to block that thread.
Code looks like following:
ViewQuery viewQuery = ViewQuery.from(design, view)
Flowable keys = bucket.async().query(viewQuery))…;
I’m able to block the last thread which will fetch the documents, but I didn’t find a way to block the one which fetches the keys.
I want to keep the memory usage as low as possible. How can I reach it? How can I make the backround thread to be blocked?