0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 11:23:52 +01:00

Impl push_bulk function

This commit is contained in:
Kegan Dougal 2015-02-05 09:43:22 +00:00
parent 543e84fe70
commit a1a4960baf
2 changed files with 19 additions and 2 deletions

View file

@ -64,8 +64,25 @@ class ApplicationServiceApi(SimpleHttpClient):
return
logger.warning("query_alias to %s received %s", uri, e.code)
@defer.inlineCallbacks
def push_bulk(self, service, events):
pass
uri = service.url + ("/transactions/%s" %
urllib.quote(str(0))) # TODO txn_ids
response = None
try:
response = yield self.put_json(
uri,
{
"events": events
},
{
"access_token": self.hs_token
})
if response: # just an empty json object
defer.returnValue(True)
except CodeMessageException as e:
logger.warning("push_bulk to %s received %s", uri, e.code)
defer.returnValue(False)
@defer.inlineCallbacks
def push(self, service, event):

View file

@ -56,7 +56,7 @@ class ApplicationServicesHandler(object):
yield self.store.update_app_service(app_service)
logger.info("Sending ping to %s...", app_service.url)
yield self.appservice_api.query_alias(app_service, "ping")
yield self.appservice_api.push(app_service, "pinger")
def unregister(self, token):
logger.info("Unregister as_token=%s", token)