Hello,
With
https://groups.google.com/g/idempiere/c/6M3ZHBOsSBg/m/LnAD76CNBgAJ and
https://idempiere.atlassian.net/browse/IDEMPIERE-3675 when a scheduler starts, it creates a new session.
This has a lot of advantages, but it also creates lots of records in AD_Session which made it hard to analyze.
I think that would be great to have the ability to "reuse" a session of one/several/all schedulers.
I'm not a specialist of session management, so perhaps the following idea is bad or not feasible.
On AD_Session, we have a WebSession field which is filled through webui sessions, webservice sessions, AdempiereActivator, ... but not with Schedulers.
So wondering if it would make sense to add a WebSession column on Scheduler.
-
If left empty, it will behave as today (ie create a new session for each scheduler run)
-
But if is filled, when the scheduler starts, instead of creating a
new session, it can search for an existing session with same User,
Role, WebSession and maybe Date(truncated)
-
If exists, it reuses it.
-
If not, it creates it and fills the WebSession field.
At the end of the Scheduler, if there is a WebSession:
-
the logout method will not be called
-
the session will remain in the Context
I haven't tested as I don't know if is a good idea to do this, if this is a good way to implement it, ...
Any thoughts?
Regards,
Nicolas