jruizgit / rules

Durable Rules Engine
MIT License
1.16k stars 206 forks source link

Python Aysnc Actions Documentation Issue #257

Open JonnyWaffles opened 5 years ago

JonnyWaffles commented 5 years ago

The Python Async Actions example is confusing in my humble opinion. I'm not entirely sure how this functionality works.

If you run the code in the example, no output is displayed and the application immediately ends. I believe this occurs because the main thread terminates and the remaining threads are marked as daemons in line 10.

If the start_timing thread's daemon status is false, "first completed" prints, but not second.

Some clarity here would go a long way towards helping understand async actions.

jruizgit commented 5 years ago

Hi, thanks for the feedback. You are right, the example is contrived and not very helpful. Async actions are intended for non blocking IO. The action can return immediately, but it will not be considered complete until the "complete" callback is called.

Note: This pattern is a lot more common and useful in node.js, where most IO APIs are asynchronous.

Don't close the issue yet, I will create a better example.

JonnyWaffles commented 5 years ago

Thanks for your response! I love your work and am very interested. Cheers.