[Twisted-Python] waitForDeferred Question
Cory Dodt
corydodt at twistedmatrix.com
Fri Mar 10 23:57:36 MST 2006
Brian Granger wrote:
> But, in many cases, the computeSomethingUsingTwisted() doesn't take
> long at all. An example of this would be probing the status of the
> remote server or a trivial computation that a server has relevant data
> for. In these cases, the result is available nearly instantly (faster
> then the user could detect, like 1 ms) and it is silly to have a job
> interface. You simply want the result directly.
Another approach: wait 10ms every time you push out a prompt. The
problem is you're trying to generate the prompt in a synchronous manner
in an asynchronous environment. 10ms is well below the threshhold that
users will notice. You'll still want job control for long calculations,
but you can present it in a more natural way.. if it's not available at
the first prompt, it's a background job.
C
More information about the Twisted-Python
mailing list