0

I have a falcon project who makes use of a Fysom state Machine. The SM change state based on informations from the outside. The SM is created at the app launch and passed to a view as an argument. At some point I'm waiting for a user event to go in a certain state, which is sent through the API to trigger a SM event.

Problem I have is that when launched with uwsgi the view is not aware of the current state of the state, it considers it's still in its initial state, so I cannot go to the desired state.

The problem does not happen with wsgiref.simpleserver.

I there a way to make the view aware of the changes on the SM ?

Thanks

4

2 回答 2

2

问题似乎与此有关:

SM 在应用启动时创建并作为参数传递给视图。

您确定您仍然有对该对象的引用,或者 uwsgi 是否在每个视图中都复制了该对象?

你可以看看: - uwsgi 共享内存 - uwsgi 缓存

于 2016-08-03T10:39:10.653 回答
2

单例设计模式,请参见此处: http: //python-3-patterns-idioms-test.readthedocs.io/en/latest/Singleton.html

于 2016-08-03T14:56:24.890 回答