Open maxpeng opened 3 years ago
First concern is about these lines
#_event_loop = asyncio.get_event_loop()
_event_loop = None
this would force all existing users to change their code to use the new init()
method. I believe the list of users is very small, but I would prefer not to force a method like this. I would leave out this code change and then only the people using init()
will have the _event_loop
that was instantiated by default be replaced by the one given in init()
.
Second concern is about people passing in outside event loops. farc assumes that the asyncio event loop is used. I don't know what would happen if other types of event loops were used.
If you have an example of your suggestion, I would appreciate seeing how it works. As in, you could create a fork of farc, make your suggested code modifications and also provide a generic example in the examples/
folder and submit a pull request.
When I perform unit testing for the state machines using
farc
, I want to independently run several test cases. That is, I want to have a new loop created for each test. Currently, once we import thefarc
package, a default event loop, which is a class variable, is created for theFramework
class.I propose to add a class method to allow us to specify the used event loop and reset the Framework.
For example: