Hi all,

I'm using diesel to evaluate some architectural decisions we need to
make. We wanted to simulate a long (say 1.5 secs long) query to an
external system/process.

However, the nature of the call maybe synchronous. Since we aim to
huge amounts of transactions we can't block diesel's main loop with
this call.

Is there a simple way to encapsulate a long-running function call into
some sort of waiting schema.

Something like the following would be nice::

   result, to = yield (wait_for_call(lambda: long_running_func
(with_arg)), sleep(2))

This would return the control to the main loop and suspend until
either the function returns or time out is detected.

However, I haven't figured out how ``wait_for_call`` could be
implemented without using OS-level threads.

Any ideas?

Thanks and best regards,
Manuel.

Reply via email to