-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add support for batching requests across unrelated fetches #504
Add support for batching requests across unrelated fetches #504
Conversation
For some reason the check fails due to an HTTP error even before the code is compiled/tested with this:
I have no clue why this is failing |
Thanks so much for your time @jordiolivares . I've checked locally, and after running [warn] /temp/fetch/fetch/src/main/scala/datasource.scala isn't formatted properly!
[warn] /temp/fetch/fetch/src/main/scala/datasource.scala isn't formatted properly!
[error] 1 files must be formatted
[error] 1 files must be formatted Running [error] /Users/juanpedromoreno/temp/fetch/fetch/src/main/scala/datasource.scala:123:32: value groupMap is not a member of List[(I, Callback)]
[error] val asMap = x.groupMap(_._1)(_._2)
[error] ^
[error] /Users/juanpedromoreno/temp/fetch/fetch/src/main/scala/datasource.scala:123:32: value groupMap is not a member of List[(I, Callback)]
[error] val asMap = x.groupMap(_._1)(_._2)
[error] ^
https://repo1.maven.org/maven2/org/http4s/http4s-blaze-client_2.12/0.23.3/http4s-blaze-client_2.12-0.23.3.pom
100.0% [##########] 5.3 KiB (35.9 KiB / s)
[error] /Users/juanpedromoreno/temp/fetch/fetch/src/main/scala/datasource.scala:130:41: type mismatch;
[error] found : F[Nothing]
[error] required: F[A]
[error] Note: Nothing <: A, but type F is invariant in type _.
[error] You may wish to define _ as +_ instead. (SLS 4.5)
[error] val fiberWork = F.handleError(resultsHaveBeenSent) { ex =>
[error] ^
[error] /Users/juanpedromoreno/temp/fetch/fetch/src/main/scala/datasource.scala:130:41: type mismatch;
[error] found : F[Nothing]
[error] required: F[A]
[error] Note: Nothing <: A, but type F is invariant in type _.
[error] You may wish to define _ as +_ instead. (SLS 4.5)
[error] val fiberWork = F.handleError(resultsHaveBeenSent) { ex =>
[error] ^ Could you please take a second look? Thanks! |
In the meantime, I'm taking a look at the CI/CD issue with the PR labeler. |
…into feature/add-batch-across-fetch
Seems like I've been in Scala 2.13 for so long I had forgotten about Scala 2.12. I've made the compilation fix, so feel free to review it again! |
Thank so much @jordiolivares ! Great contribution 🙌 |
I noticed that when processing Fetch requests across
Fetch.run
calls on an HTTP server the fetch requests weren't batched across executions. This means that if we were processing for example 3000 requests simultaneously where each Fetch is for a single ID, we would have 3000 calls to theDataSource.fetch
method.This PR thus adds support for bundling the calls within a given interval in order to produce a single
DataSource.batch
call instead. This would massively help throughput of HTTP servers at the cost of latency