You are doing blocking calls inside a non-blocking async stream, in a map function. That’s a bad idea
©
You can use sync bucket in parallel to an async bucket, separately, but mixing the two together isn’t possible and will lead to blocking and timeouts, as you saw.
What I mean by separately is more along the lines of:
//this is OK
JsonObject updatedContent = JsonObject.emtpy(); //or something more relevant
JsonDocument docUpdated = JsonDocument.create("key1", updatedContent);
aBucket.upsert(docUpdated).subscribe(); //we just update in a fire and forget fashion
JsonDocument otherDoc = bucket.get("key2"); //do something with the other doc
As a side note, on your test you could have directly used get
without Observable.just
(for a single key):
Observable<Object> ob = aBucket.get(key)
//still a bad idea
.map(o -> adjustDoc(o));