This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Push some deferred wrangling down into DeferredCache #8572
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Modify `DeferredCache.get()` to return `Deferred`s instead of `ObservableDeferred`s. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this happens anyway, at
synapse/synapse/util/caches/deferred_cache.py
Line 264 in e67f572
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh, except that's slightly different. I better write some tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I've stared at this harder and am pretty sure it's redundant. As noted above, if the function fails, then we call
entry.invalidate()
on the "temporary" entry in the pending_deferred_cache. The only difference between that and callingcache.invalidate(cache_key)
as shown here would be if there was also an entry in the main cache. But we know that can't be the case, because we checked it at line 210, and there is no way for it to have been populated in the meantime.https://github.com/matrix-org/synapse/pull/8572/files#diff-3aa4bc9d8830ffd035d53b8af86b548a21f2a4cddb3e5240445661614a88a08fR210
(unless someone decided to sidestep the CacheDescriptor and manually call
cache.set
orcache.prefill
while this request was running? but that would be silly, and even if they did it's not obvious that we should invalidate it here.)In short, I think this is handled correctly in DeferredCache itself.