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
c7daf313
Commit
c7daf313
authored
8 years ago
by
Kegan Dougal
Browse files
Options
Downloads
Patches
Plain Diff
Use observable deferreds because they are sane
parent
8a8ad46f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/rest/client/v2_alpha/sendtodevice.py
+4
-3
4 additions, 3 deletions
synapse/rest/client/v2_alpha/sendtodevice.py
with
4 additions
and
3 deletions
synapse/rest/client/v2_alpha/sendtodevice.py
+
4
−
3
View file @
c7daf313
...
...
@@ -20,6 +20,7 @@ from twisted.internet import defer
from
synapse.http
import
servlet
from
synapse.http.servlet
import
parse_json_object_from_request
from
synapse.rest.client.v1.transactions
import
HttpTransactionCache
from
synapse.util.async
import
ObservableDeferred
from
._base
import
client_v2_patterns
...
...
@@ -47,14 +48,14 @@ class SendToDeviceRestServlet(servlet.RestServlet):
def
on_PUT
(
self
,
request
,
message_type
,
txn_id
):
try
:
res_deferred
=
self
.
txns
.
get_client_transaction
(
request
,
txn_id
)
res
=
yield
res_deferred
res
=
yield
res_deferred
.
observe
()
defer
.
returnValue
(
res
)
except
KeyError
:
pass
res_deferred
=
self
.
_put
(
request
,
message_type
,
txn_id
)
res_deferred
=
ObservableDeferred
(
self
.
_put
(
request
,
message_type
,
txn_id
)
)
self
.
txns
.
store_client_transaction
(
request
,
txn_id
,
res_deferred
)
res
=
yield
res_deferred
res
=
yield
res_deferred
.
observe
()
defer
.
returnValue
(
res
)
@defer.inlineCallbacks
...
...
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