Mercurial > code > home > repos > rdfdb
changeset 47:9bd2a537caaa
huge speedup switching from cyclone.httpclient.fetch to treq. 300ms updates become 7ms. maybe it was looking up names or some slow network connect thing before, and now it's reusing a connection.
Ignore-this: 745f3d7116702d2dcc57d300631fa052
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 27 May 2019 08:54:23 +0000 |
parents | 3b36b2c8ae65 |
children | 7c3cd440619b |
files | rdfdb/patchsender.py |
diffstat | 1 files changed, 7 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/rdfdb/patchsender.py Mon May 27 08:08:23 2019 +0000 +++ b/rdfdb/patchsender.py Mon May 27 08:54:23 2019 +0000 @@ -1,6 +1,6 @@ import logging, time from typing import List, Tuple, Optional -import cyclone.httpclient +import treq from rdflib import URIRef from twisted.internet import defer from rdfdb.patch import Patch @@ -125,11 +125,10 @@ log.debug("sendPatch to %s took %.1fms" % (putUri, dt)) return done - return cyclone.httpclient.fetch( - url=putUri.toPython().encode('ascii'), - method=b'PUT', - headers={ - b'Content-Type': [b'application/json'] - }, - postdata=body.encode('utf8'), + return treq.put(putUri.toPython(), + data=body.encode('utf8'), + headers={ + b'Content-Type': [b'application/json'] + }, + timeout=2, ).addCallback(putDone)