-
Notifications
You must be signed in to change notification settings - Fork 411
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
[RFC] feat: scoped requests #3229
base: main
Are you sure you want to change the base?
Conversation
💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe. |
375bc68
to
a8df79e
Compare
a8df79e
to
87329b7
Compare
handler.apply | ||
case Right(scopedHandler) => | ||
val handler = scopedHandler.toHandler | ||
(req: Request) => ZIO.scoped(handler(req)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scope lifetime must essentially span across https://github.com/jgranstrom/zio-http/blob/feat-scoped-requests/zio-http/jvm/src/main/scala/zio/http/netty/server/ServerInboundHandler.scala#L99 and https://github.com/jgranstrom/zio-http/blob/feat-scoped-requests/zio-http/jvm/src/main/scala/zio/http/netty/server/ServerInboundHandler.scala#L79, not sure on that one yet.
Thanks for tackling this issue! My two cents: I think the |
Yeah I went with that initially but it gets fairly convoluted to thread that through everything, so I thought of a less invasive option to just fork it top-level, but also agree that it would be cleaner for the outside to do that. |
/fixes #3197
/claim #3197
RFC Adds support for per-request Scopes at server level.
Adds the ability to run a server that provides a scope for each request. This is to not add any overhead or overly complicate the existing path that does not provide request-bound scopes.
I have not added tests or similar yet as I need some feedback on the idea of this as a solution first.
(Edit: also only implemented with the Netty driver for the above reason)