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
Package registry
Container Registry
Model registry
Operate
Terraform modules
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
Timo Ley
synapse
Commits
641efb6a
Commit
641efb6a
authored
8 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
Fix the deduplication of incoming direct-to-device messages
parent
e9939252
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/rest/client/v2_alpha/sendtodevice.py
+12
-1
12 additions, 1 deletion
synapse/rest/client/v2_alpha/sendtodevice.py
synapse/storage/deviceinbox.py
+4
-0
4 additions, 0 deletions
synapse/storage/deviceinbox.py
with
16 additions
and
1 deletion
synapse/rest/client/v2_alpha/sendtodevice.py
+
12
−
1
View file @
641efb6a
...
...
@@ -19,6 +19,7 @@ from twisted.internet import defer
from
synapse.http.servlet
import
parse_json_object_from_request
from
synapse.http
import
servlet
from
synapse.rest.client.v1.transactions
import
HttpTransactionStore
from
._base
import
client_v2_patterns
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -40,9 +41,17 @@ class SendToDeviceRestServlet(servlet.RestServlet):
self
.
auth
=
hs
.
get_auth
()
self
.
store
=
hs
.
get_datastore
()
self
.
is_mine_id
=
hs
.
is_mine_id
self
.
txns
=
HttpTransactionStore
()
@defer.inlineCallbacks
def
on_PUT
(
self
,
request
,
message_type
,
txn_id
):
try
:
defer
.
returnValue
(
self
.
txns
.
get_client_transaction
(
request
,
txn_id
)
)
except
KeyError
:
pass
requester
=
yield
self
.
auth
.
get_user_by_req
(
request
)
content
=
parse_json_object_from_request
(
request
)
...
...
@@ -62,7 +71,9 @@ class SendToDeviceRestServlet(servlet.RestServlet):
yield
self
.
store
.
add_messages_to_device_inbox
(
local_messages
)
defer
.
returnValue
((
200
,
{}))
response
=
(
200
,
{})
self
.
txns
.
store_client_transaction
(
request
,
txn_id
,
response
)
defer
.
returnValue
(
response
)
def
register_servlets
(
hs
,
http_server
):
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/deviceinbox.py
+
4
−
0
View file @
641efb6a
...
...
@@ -132,5 +132,9 @@ class DeviceInboxStore(SQLBaseStore):
)
txn
.
execute
(
sql
,
(
user_id
,
device_id
,
up_to_stream_id
))
return
self
.
runInteraction
(
"
delete_messages_for_device
"
,
delete_messages_for_device_txn
)
def
get_to_device_stream_token
(
self
):
return
self
.
_device_inbox_id_gen
.
get_current_token
()
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