⚡️ Respond to all queued fetch requests with single response #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: This is built on top of #102 and the base branch has been set accordingly. I will rebase on latest main before merging.
Describe the purpose of your pull request
When performing a fetch, queue up any new requests and then respond to all of the fetches with the result of the pending fetch.
This avoids making multiple consecutive fetch requests to the server.
Uses a technique I describe in [this blog post](https://blog.sequin.io/genserver-reply-dont-call-us-well-call-you/](https://blog.sequin.io/genserver-reply-dont-call-us-well-call-you/) along with a list of pending callers in the GenServer state.
Related issues (only if applicable)
https://trello.com/c/H6PU0SG0/15-only-one-config-json-download-at-a-time
Requirement checklist (only if applicable)