Normalize courier calls to simplify :commit handling #295
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.
This fixes #290.
I'm going to label this as a bug because I think it was unintended, and thus has now been fixed. Currently if you execute many
fetch/4
calls at the same time, it becomes impossible to know which of them actually wrote a value to the cache:This makes chaining calls on (such as then providing an expiration for your record) will run for every call instead of just the one which triggered the write. Ideally, this would run once in the process which was first to initiate the fetch. This PR fixes this to be the case, thus making the recommended expire pattern work correctly.
With this in place, chained calls based on
:commit
will only fire in a single process instead of all of them. This is far better ergonomically, and also in terms of performance as we're not wasting many cache calls unnecessarily.