hi!<div><br></div><div>i&#39;m currently writing a reverse proxy with twisted and i&#39;ve a problem with a deferred </div><div>function in my handleHeader method.</div><div><br></div><div>the code looks simplified like this:</div>
<div><br></div><div><div>class MyProxyClient(proxy.ProxyClient):</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>@defer.inlineCallbacks</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>def handleHeader(self, key, value):</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>if key.lower() == &#39;location&#39;:</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>clientCreator = protocol.ClientCreator(reactor, Redis, db=3)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>redis = yield clientCreator.connectTCP(&quot;localhost&quot;, 6379)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>value = yield redis.get(&#39;myproxy:hashcode:%s&#39; % value)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>proxy.ProxyClient.handleHeader(self,key,value)</div></div><div><br></div><div><br clear="all">as the handleHeader caller doesn&#39;t wait for a deferred to finish, the location header is </div>
<div>added after handleResponseEnd is already called and therefore never makes it to the client.</div><div><br></div><div>is there a way to convert the non-blocking redis call to a blocking redis call?</div><div>i know that there&#39;s a blocking client library for redis but i&#39;d rather use only txredis if possible.</div>
<div><br></div><div><br></div><div>regards,</div><div>  stefan</div><div><br></div><div><br>-- <br>Stefan Grosz &lt;<a href="mailto:stefan@grosz.at">stefan@grosz.at</a>&gt;<br>Stadtausstellungs-, Gemeindeausstellungs-, Stadtinformations- und Gemeindeinformationsplanungs GmbH<br>
A-1100 Wien, Buchengasse 42<br>Mobil: +43 650 2643435<br>Fax: +43 7243 57435<br><br><a href="http://www.stadtausstellung.at">http://www.stadtausstellung.at</a><br><br>
</div>