summary refs log tree commit diff
path: root/synapse/storage/appservice.py
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-03-16 15:24:32 +0000
committerKegan Dougal <kegan@matrix.org>2015-03-16 15:24:32 +0000
commitf0d6f724a241a50d4a12b1c00af2a4cc6f9a43f1 (patch)
tree3cfad53bcef8a3b08e25e9a08da1f91f78789a5a /synapse/storage/appservice.py
parentImplement ServiceQueuer with tests. (diff)
downloadsynapse-f0d6f724a241a50d4a12b1c00af2a4cc6f9a43f1.tar.xz
Set the service ID as soon as it is known.
Diffstat (limited to 'synapse/storage/appservice.py')
-rw-r--r--synapse/storage/appservice.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/storage/appservice.py b/synapse/storage/appservice.py
index e928812bc9..06b3a04afc 100644
--- a/synapse/storage/appservice.py
+++ b/synapse/storage/appservice.py
@@ -101,11 +101,12 @@ class ApplicationServiceStore(SQLBaseStore):
         if not service.hs_token:
             raise StoreError(500, "No HS token")
 
-        yield self.runInteraction(
+        as_id = yield self.runInteraction(
             "update_app_service",
             self._update_app_service_txn,
             service
         )
+        service.id = as_id
 
         # update cache TODO: Should this be in the txn?
         for (index, cache_service) in enumerate(self.services_cache):
@@ -124,7 +125,7 @@ class ApplicationServiceStore(SQLBaseStore):
                 "update_app_service_txn: Failed to find as_id for token=",
                 service.token
             )
-            return False
+            return
 
         txn.execute(
             "UPDATE application_services SET url=?, hs_token=?, sender=? "
@@ -144,7 +145,7 @@ class ApplicationServiceStore(SQLBaseStore):
                         "as_id, namespace, regex) values(?,?,?)",
                         (as_id, ns_int, json.dumps(regex_obj))
                     )
-        return True
+        return as_id
 
     def _get_as_id_txn(self, txn, token):
         cursor = txn.execute(