[Twisted-Python] twistd caching method calls?

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Sun Jun 15 10:14:45 MDT 2014


On 03:23 pm, jim at rainville.net wrote:
>Hi -
>
>I have a very simple twisted service that reads a temperature sensor. A 
>client can ask for the current temperature via JSON and as a result the 
>service will read the temperature sensor and respond with the current 
>temp. This works great if I run it as a python module from the command 
>line but if I run it as a service with twistd it seems to read the temp 
>on startup then the temp seems to be cached as it never changes. I have 
>print calls in the getTemp method right before it calls into the 
>hardware library, they are getting called in both cases - but the 
>return from the call never changes in the twistd case. Any ideas?
>
>Also, I have another service (not twisted) that runs in the background 
>that periodically reads the temp and responds to temperature changes. 
>This is working fine so I’m pretty sure the problem is isolated to 
>twistd.

There's no intentional caching of this sort added automatically by 
`twistd` or by any other part of Twisted.  Can you share your code? 
Someone might spot what's going on.

As an aside, sounds like a good project - it sounds similar to something 
I've been working on.  Can you share your code? ;)

Jean-Paul



More information about the Twisted-Python mailing list