Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Deduplicate identical /sync requests #668
Conversation
NegativeMjark
assigned
ara4n
Mar 24, 2016
oddvar
added
the
in progress
label
Mar 24, 2016
ara4n
commented on an outdated diff
Mar 24, 2016
synapse/util/caches/response_cache.py
| +# See the License for the specific language governing permissions and | ||
| +# limitations under the License. | ||
| + | ||
| +from synapse.util.async import ObservableDeferred | ||
| + | ||
| + | ||
| +class ResponseCache(object): | ||
| + """ | ||
| + This caches a deferred response. Until the deferred completes it will be | ||
| + returned from the cache. This means that if the client retries the request | ||
| + while the response is still being computed, that original response will be | ||
| + used rather than trying to compute a new response. | ||
| + """ | ||
| + | ||
| + def __init__(self): | ||
| + self.pending_result_cache = {} # Request that haven't finished yet. |
|
|
|
this looks plausible to me, but i'm hardly a twisted expert. |
ara4n
assigned
NegativeMjark
and unassigned
ara4n
Mar 24, 2016
NegativeMjark
added some commits
Mar 24, 2016
NegativeMjark
merged commit 3e8bb99
into
develop
Mar 24, 2016
6 of 8 checks passed
Sytest Postgres (Commit)
Build #214 origin/markjh/deduplicate in progress...
Details
Sytest Postgres (Merged PR)
Build started sha1 is merged.
Details
Flake8 + Packaging (Commit)
Build #211 origin/markjh/deduplicate succeeded in 28 sec
Details
Flake8 + Packaging (Merged PR)
Build finished.
Details
Sytest SQLite (Commit)
Build #215 origin/markjh/deduplicate succeeded in 4 min 22 sec
Details
Sytest SQLite (Merged PR)
Build finished.
Details
Unit Tests (Commit)
Build #256 origin/markjh/deduplicate succeeded in 1 min 11 sec
Details
Unit Tests (Merged PR)
Build finished.
Details
oddvar
removed
the
in progress
label
Mar 24, 2016
erikjohnston
commented on the diff
Mar 29, 2016
erikjohnston
commented on the diff
Mar 29, 2016
synapse/rest/client/v2_alpha/sync.py
| @@ -115,6 +115,8 @@ def on_GET(self, request): | ||
| ) | ||
| ) | ||
| + request_key = (user, timeout, since, filter_id, full_state) |
erikjohnston
Owner
|
richvdh
deleted the
markjh/deduplicate
branch
Dec 1, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NegativeMjark commentedMar 24, 2016
If two /sync requests arrive at the server at the same time then use the same sync response for both of them.