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

Make futures optional per dispatch call #138

Open
arximboldi opened this issue Feb 21, 2022 · 0 comments
Open

Make futures optional per dispatch call #138

arximboldi opened this issue Feb 21, 2022 · 0 comments

Comments

@arximboldi
Copy link
Owner

#128 introduced a new feature to be able to track the completion of reduction of actions and effects. This introduces certain overhead, so it is made optional per store using the lager::with_futures reducer.

Ideally, however, this could be made optional per call to dispatch. There are two ways:

  1. Add a different version of dispatch() (name suggestions? dispatch_future(), dispatch_(), dispatch_with(), ???) that returns a future, and have the default version not return one at all. In the current version, dispatch() always returns a future, but you get runtime errors when using the returned future if futures are not enabled in the store.

    This is probably cleanest option from an API POV but, in a trivial implementation, it imposes some penalty to creating and passing around contexes. Maybe there is a way we can instead of carrying around the dispatchers for various actions as function objects in the context, we create a static vtable for a particular combination of actions and parent context. Implementing this optimization, while a bit difficult, would also be more efficient than what we currently have for the general case.

  2. Add a flag to dispatch(a, [flag]) to enable futures for each dispatch call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant