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

RFC: Implement system to optionally execute observer hooks in a non-blocking fashion #9

Open
taneliang opened this issue Jun 21, 2020 · 0 comments

Comments

@taneliang
Copy link
Owner

taneliang commented Jun 21, 2020

GentMutator currently waits for all observer hook promises to resolve before continuing with its next steps. As these hooks should support slow work such as network requests (for logging, cache updates, search index updates, sending emails, etc) or other long-running, non-urgent computations, it may be a good idea to implement a non-blocking async runner that can execute such tasks without blocking the mutator from progressing.

Running hooks in such an async fashion should be optional, as there are many cases where we do want these hooks to block.

Possible implementations

  • React's experimental scheduler, a cooperative scheduling system that supports interruption and job priorities. It could possibly be used in Gent to allow our hooks to schedule work to be executed when the server is idle, while remaining responsive to new requests. An introduction to how it's used in React concurrent mode is available in this blog post.
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

No branches or pull requests

1 participant