# HG changeset patch # User Drew Perttula # Date 1558947263 0 # Node ID 9bd2a537caaa87416bbb32d25953d6444afbf22c # Parent 3b36b2c8ae65a43c6e5a904452a70e1ea4f87fe4 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 diff -r 3b36b2c8ae65 -r 9bd2a537caaa rdfdb/patchsender.py --- 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)