Skip to content
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

Perform GRPC route building lazily on bind #2467

Merged
merged 2 commits into from
Dec 15, 2022

Conversation

daschl
Copy link
Contributor

@daschl daschl commented Dec 13, 2022

Motivation:

At the moment building a GRPC route is performed right when the application registers a new one at the high level API.

Since every route needs an execution strategy when being built, the execution strategy needs to be provided at construction time of the ServiceFactory/Builder. In order to improve the user experience and to make the execution strategy an optional builder method the building of the routes needs to be moved to a later point in the build stage.

Modifications:

This changeset, in preparation to making the execution strategy optional in a later commit, makes the route building lazy by moving it inside a closure which is executed at "bind" time instead of being evaluated immediately.

To preserve the current semantics (especially that an error is thrown if two routes on the same path are provided by the user), the error reporting is still performed eagerly. The merge code also had to be changed slightly to take this invariant into account.

Result:

Lazy GRPC route building in preparation to make the execution strategy optional.

Motivation:

At the moment building a GRPC route is performed right when
the application registers a new one at the high level API.

Since every route needs an execution strategy when being built,
the execution strategy needs to be provided at construction time
of the ServiceFactory/Builder. In order to improve the user
experience and to make the execution strategy an optional
builder method the building of the routes needs to be moved
to a later point in the build stage.

Modifications:

This changeset, in preparation to making the execution strategy
optional in a later commit, makes the route building lazy by
moving it inside a closure which is executed at "bind" time instead
of being evaluated immediately.

To preserve the current semantics (especially that an error is thrown
if two routes on the same path are provided by the user), the error
reporting is still performed eagerly. The merge code also had to
be changed slightly to take this invariant into account.

Result:

Lazy GRPC route building in preparation to make the execution strategy
optional.
@daschl daschl self-assigned this Dec 13, 2022
@daschl daschl merged commit b1f8a4d into apple:main Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants