|
The other aspect of how Pythomnic deals with external systems is that the
interaction is synchronous, the call to execute does not return until the
processing is complete. To prevent hanging the entire application from a
stuck external system we need the pool. Each pool maintains its own set of
worker threads and hands the arriving calls to them for actual execution.
What hangs is the worker thread, the caller thread will only get blocked for
so long, then abandon the request and proceed with an exception. This is far
from an ideal scenario, as the call is underway and may even complete
successfully 0.01 second after the caller throws, but the application has
to keep running.
The value of a timeout limiting all the calls to a particular pool is configured
in config/config_connections.py as
config.set("the_system.timeout", 30.0)
but the exact value to be used for any particular call could be less than that
- in case the entire request has less time left to it.
For example if a request from a client arrives on an interface which is
configured with a 40 seconds timeout, and your code spends 20 seconds doing
something else before issuing a call to the_system.execute, then it's 20 seconds
the request has left to it and though the_system pool is configured with 30
seconds timeout, the latter is reduced to 20 seconds so that it fails early,
at appropriate time.
|
Features Download Documentation Tutorial |