diff options
author | Kegan Dougal <kegan@matrix.org> | 2015-03-05 15:40:07 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2015-03-05 15:40:07 +0000 |
commit | be09c23ff02bee9c63611df528a269fb157f2f3c (patch) | |
tree | 1ad1c6621efe40109e95db257514d7f7618cb8a6 /synapse/appservice/api.py | |
parent | Rename rooms_to_listeners to room_to_listeners, for consistency with user_ an... (diff) | |
download | synapse-be09c23ff02bee9c63611df528a269fb157f2f3c.tar.xz |
Add txn_id kwarg to push methods
Diffstat (limited to 'synapse/appservice/api.py')
-rw-r--r-- | synapse/appservice/api.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py index c2179f8d55..c17fb219c5 100644 --- a/synapse/appservice/api.py +++ b/synapse/appservice/api.py @@ -72,11 +72,16 @@ class ApplicationServiceApi(SimpleHttpClient): defer.returnValue(False) @defer.inlineCallbacks - def push_bulk(self, service, events): + def push_bulk(self, service, events, txn_id=None): events = self._serialize(events) + if txn_id is None: + logger.warning("push_bulk: Missing txn ID sending events to %s", + service.url) + txn_id = str(0) + uri = service.url + ("/transactions/%s" % - urllib.quote(str(0))) # TODO txn_ids + urllib.quote(txn_id)) response = None try: response = yield self.put_json( @@ -97,8 +102,8 @@ class ApplicationServiceApi(SimpleHttpClient): defer.returnValue(False) @defer.inlineCallbacks - def push(self, service, event): - response = yield self.push_bulk(service, [event]) + def push(self, service, event, txn_id=None): + response = yield self.push_bulk(service, [event], txn_id) defer.returnValue(response) def _serialize(self, events): |