hi!<div><br></div><div>i'm currently writing a reverse proxy with twisted and i'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() == 'location':</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("localhost", 6379)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>value = yield redis.get('myproxy:hashcode:%s' % 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'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's a blocking client library for redis but i'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 <<a href="mailto:stefan@grosz.at">stefan@grosz.at</a>><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>