-
Notifications
You must be signed in to change notification settings - Fork 113
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
Connections not released after each requests ? #50
Comments
OK seems the problem is elsewhere. I thought backpressure would trigger once one request is being executed (thus skiping some interval ticks) but it's not. My main requests executes twice simultaneously once 2 seconds have been skipped and locks the pool. Would there be anyway to enforce no more than one main request at a time ? |
Seems like using updateObservable = Observable.interval(2, 2, TimeUnit.SECONDS)
.onBackpressureLatest()
.map(i -> Observable.empty())
.lift(db
.select("SELECT * FROM elements")
.parameterListOperator()
.autoMap(Element.class)
)
.compose(service.asTransformer())
.doOnNext(t -> System.out.println("updated " + t))
.map(e -> Observable.<Object> just(e.part1, e.part2, new Timestamp(e.updated_at), e.id))
.lift(db
.update("UPDATE elements SET part1 = ?, part2 = ?, updated_at = ? WHERE id = ?")
.parameterListOperator()
)
.compose(Observable::merge)
.doOnNext(t -> System.out.println("done " + t))
.retry((i, t) -> {
if (i < RETRIES) {
L.warn("Something went wrong. Retry (" + i + "/" + RETRIES + ")...", t);
return true;
}
else {
L.error("Something is still wrong after " + RETRIES + " retries. Fix it. " + NAME + " stopped.", t);
return false;
}
})
.onErrorResumeNext(t -> Observable.empty()); |
If you can spare a minute to explain why lift works and not flat map it would be great :) |
Hi, sorry still a bit short on time. I hope to have a look soon. |
are there links to blogs/more documentation on transactions? |
Hi,
I'm having some problem on this observable. I'm using rxjava-jdbc 0.6.8 with a min size 1 and a max size 2 for the Hikari pool.
Here are the logs this shows
So each time it does 2 requests, it freezes and times out at 30 seconds (I guess cause all the connections are used). It then retries , succeeds at the id it failed on, succeeds at the next and freezes once again when already 2 requests have been done. And so on.
I must not be understanding something about the pools here. Please let me know if i'm doing something wrong.
The text was updated successfully, but these errors were encountered: