Skip to content
Snippets Groups Projects
Commit be09c23f authored by Kegan Dougal's avatar Kegan Dougal
Browse files

Add txn_id kwarg to push methods

parent dc4b774f
No related branches found
No related tags found
No related merge requests found
...@@ -72,11 +72,16 @@ class ApplicationServiceApi(SimpleHttpClient): ...@@ -72,11 +72,16 @@ class ApplicationServiceApi(SimpleHttpClient):
defer.returnValue(False) defer.returnValue(False)
@defer.inlineCallbacks @defer.inlineCallbacks
def push_bulk(self, service, events): def push_bulk(self, service, events, txn_id=None):
events = self._serialize(events) 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" % uri = service.url + ("/transactions/%s" %
urllib.quote(str(0))) # TODO txn_ids urllib.quote(txn_id))
response = None response = None
try: try:
response = yield self.put_json( response = yield self.put_json(
...@@ -97,8 +102,8 @@ class ApplicationServiceApi(SimpleHttpClient): ...@@ -97,8 +102,8 @@ class ApplicationServiceApi(SimpleHttpClient):
defer.returnValue(False) defer.returnValue(False)
@defer.inlineCallbacks @defer.inlineCallbacks
def push(self, service, event): def push(self, service, event, txn_id=None):
response = yield self.push_bulk(service, [event]) response = yield self.push_bulk(service, [event], txn_id)
defer.returnValue(response) defer.returnValue(response)
def _serialize(self, events): def _serialize(self, events):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment