TROInMemorySessionManager not releasing inactive sessions

I’m having a problem with sessions:

RO is not releasing expired sessions. I need to call some method, like ClearSessions(true) to do the job ? or it was supposed to be automatic ?

I’m using my custom class session (implementing event OnCustomCreateSession).

simplified code:

// module procedure TModule.createSessionManager;

begin

// Manager
mySessionManager := TROInMemorySessionManager.Create(nil);
mySessionManager.OnCustomCreateSession := createSessionEvent;
mySessionManager.SessionDuration := 1; //test 1 min
end;

procedure TModule.createSessionEvent(const aSessionID: TGUID; var Session: TROSession);

begin

Session := TMySession.Create(aSessionID);
end;

// my custom session class
destructor TMySession.Destroy;

begin

// never shows logs…
Log.Add(‘Session destroyed’);

inherited;
end;

// my service
constructor TMyService.Create(aOwner : TComponent);

begin

SessionManager := mySessionManager;

end;

Thanks,
Willian.

Hello,
It clears session automatically.
You should also change mySessionManager.SessionCheckInterval property:

begin

  // Manager
  mySessionManager := TROInMemorySessionManager.Create(nil);
  mySessionManager.OnCustomCreateSession := createSessionEvent;
  mySessionManager.SessionDuration := 1; //test 1 min
  mySessionManager.SessionCheckInterval := 1;
end;

Hi,

Worked, thanks!

But, it is not enabled by default … if I not set SessionCheckInterval (any value), session will not be released after 15 minutes (SessionDuration default value).

A note on wiki (TROCustomSessionManager.SessionCheckInterval) will avoid future confusions… and there this field is marked as protected !

http://wiki.remobjects.com/wiki/TROCustomSessionManager_Class

Willian.

Hello,
Thanks, the issue was logged as #55264