-
Notifications
You must be signed in to change notification settings - Fork 0
Auto initialize fails #1
Comments
Session auto initialization is not a session config, but an application one. I propose to add it to the |
Session needs the Application object because it needs to hook into it's Event manager. So the dependency is there, I suggest |
What if we move the auto save thing to the application initialization? I think that the session does not really need to know about the actual saving process. |
I have to look into that. It might be that session has not evolved with changes in Foundation. |
I think this is exactly the problem. |
What if the SessionManager depends on a singleton instance of event manager instead? Because it only needs the application to hook into the event manager. And I still think that the auto save is out of scope of session manager. Session manager needs to provide a way to save the session. The outside world needs to call it. So I'd move the event hook to the application initialization. |
If the Application processes |
auto init is more of a v1 legacy, the question is if that should be kept. There are situations where you don't want the session to autostart (for example the table hasn't been created yet), currently that is quite complex. I do however think that once a session is started, it should be auto-saved. Perhaps the session itself shout register itself for a shutdown event when started, en de-register when stopped. That would require the event instance to be injected in |
I agree it should be autosaved. I am just not really fine with having something injected into the session manager. As I said, since it is created in the application (where auto init is decided as well), it could be registered there as well. However in this case the deregister is not possible from the session manager. Anyway, rather an event emitter than the whole application injected. |
You could split the problem. When a new session object is initiated, always create a shutdown event entry for it. And then use enable/disable methods and a flag inside the Session manager to determine if that event actually does something? |
Hm, could work... |
Using session with
auto_initialize
config set to true fails, because it tries to fetch an application component before it gets initialized.The text was updated successfully, but these errors were encountered: