Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
3f06bbc0
Unverified
Commit
3f06bbc0
authored
9 months ago
by
Erik Johnston
Committed by
GitHub
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Always return OTK counts (#17275)
Broke in
https://github.com/element-hq/synapse/pull/17215
parent
fcbc79bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/17275.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/17275.bugfix
synapse/handlers/sync.py
+29
-4
29 additions, 4 deletions
synapse/handlers/sync.py
with
30 additions
and
4 deletions
changelog.d/17275.bugfix
0 → 100644
+
1
−
0
View file @
3f06bbc0
Fix bug where OTKs were not always included in `/sync` response when using workers.
This diff is collapsed.
Click to expand it.
synapse/handlers/sync.py
+
29
−
4
View file @
3f06bbc0
...
@@ -285,7 +285,11 @@ class SyncResult:
...
@@ -285,7 +285,11 @@ class SyncResult:
)
)
@staticmethod
@staticmethod
def
empty
(
next_batch
:
StreamToken
)
->
"
SyncResult
"
:
def
empty
(
next_batch
:
StreamToken
,
device_one_time_keys_count
:
JsonMapping
,
device_unused_fallback_key_types
:
List
[
str
],
)
->
"
SyncResult
"
:
"
Return a new empty result
"
"
Return a new empty result
"
return
SyncResult
(
return
SyncResult
(
next_batch
=
next_batch
,
next_batch
=
next_batch
,
...
@@ -297,8 +301,8 @@ class SyncResult:
...
@@ -297,8 +301,8 @@ class SyncResult:
archived
=
[],
archived
=
[],
to_device
=
[],
to_device
=
[],
device_lists
=
DeviceListUpdates
(),
device_lists
=
DeviceListUpdates
(),
device_one_time_keys_count
=
{}
,
device_one_time_keys_count
=
device_one_time_keys_count
,
device_unused_fallback_key_types
=
[]
,
device_unused_fallback_key_types
=
device_unused_fallback_key_types
,
)
)
...
@@ -523,7 +527,28 @@ class SyncHandler:
...
@@ -523,7 +527,28 @@ class SyncHandler:
logger
.
warning
(
logger
.
warning
(
"
Timed out waiting for worker to catch up. Returning empty response
"
"
Timed out waiting for worker to catch up. Returning empty response
"
)
)
return
SyncResult
.
empty
(
since_token
)
device_id
=
sync_config
.
device_id
one_time_keys_count
:
JsonMapping
=
{}
unused_fallback_key_types
:
List
[
str
]
=
[]
if
device_id
:
user_id
=
sync_config
.
user
.
to_string
()
# TODO: We should have a way to let clients differentiate between the states of:
# * no change in OTK count since the provided since token
# * the server has zero OTKs left for this device
# Spec issue: https://github.com/matrix-org/matrix-doc/issues/3298
one_time_keys_count
=
await
self
.
store
.
count_e2e_one_time_keys
(
user_id
,
device_id
)
unused_fallback_key_types
=
list
(
await
self
.
store
.
get_e2e_unused_fallback_key_types
(
user_id
,
device_id
)
)
cache_context
.
should_cache
=
False
# Don't cache empty responses
return
SyncResult
.
empty
(
since_token
,
one_time_keys_count
,
unused_fallback_key_types
)
# If we've spent significant time waiting to catch up, take it off
# If we've spent significant time waiting to catch up, take it off
# the timeout.
# the timeout.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment