Schedulers : reuse sessions

39 views
Skip to first unread message

Nicolas Micoud

unread,
Aug 12, 2025, 4:47:39 AMAug 12
to iDempiere
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

Carlos Antonio Ruiz Gomez

unread,
Aug 22, 2025, 2:50:35 PMAug 22
to idem...@googlegroups.com
Hi Nicolas, your idea sounds possible.

Maybe you can fill the WebSession with some indicator for the session, for example:
Scheduler_[AD_Scheduler_ID]_[Date]
and then look for a session that matches that WebSession and reuse it.

We could even make this configurable with context variables, for example adding an AD_Scheduler.SessionIdFormat - or something like that.  So, we can control how to reuse the session (f.e. daily, monthly, etc).


> 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

This part is maybe not required, AFAIR you can close the session, and then reuse it later, but maybe better to test if that's OK.

Regards,

Carlos Ruiz
Nicolas --

Nicolas Micoud

unread,
Aug 26, 2025, 3:12:46 AM (11 days ago) Aug 26
to iDempiere
Hi Carlos,

Ticket created: https://idempiere.atlassian.net/browse/IDEMPIERE-6661
PR (draft): https://github.com/idempiere/idempiere/pull/2894

I've added some comments in the ticket.

Regards,

Nicolas

Heng Sin Low

unread,
Aug 26, 2025, 3:57:31 AM (11 days ago) Aug 26
to idem...@googlegroups.com
Would this show up as "Active Session" in the "Active Session" window ?

I think we already have a similar issue with the sessions created by idempiere-rest request showing up in the "Active Session" window.

--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/idempiere/a52826a2-3d43-4aa7-82b3-c08fccc1a46bn%40googlegroups.com.

Nicolas Micoud

unread,
Aug 26, 2025, 4:07:36 AM (11 days ago) Aug 26
to iDempiere
I'm not using idempiere-rest so not aware of such issue, bu if the session remains as "not processed", it will be indeed shown in "Active Session" window.
Reply all
Reply to author
Forward
0 new messages