Jump to content

hyperserver the best way to clear a session on database when the web server restarts or the server restarts


donlego

Recommended Posts

hello 

i have unigui app with limiting the concurent login /access, when user session reached max limit my app will reject the login

when use traditional unigui , it can handle when web server/server restart, then session list is become empty

now i use hyper server unigui  ver 1506, and store the user session on database, user on close browser tab/close the browser delete the session store in database, but sometime (i dont know why there still session list left /undeleted)

my question is

1.why there sometime still session on the database left, i use delete session on database with this event

  • TUniMainModule.UniGUIMainModuleBrowserClose
  • TUniMainModule.UniGUIMainModuleDestroy
  • On Logout menu(user click the logout)
  • my delete function
    •  q.SQL.Text := 'DELETE FROM PENGGUNA_SESSION WHERE ID_SESSION=' +
                QuotedStr(ID_SESSION) + '';

2. what best method to clear database session when web server restart/server restart

3.what best method can i use to clear left session every 5 minutes with session log time - current_time >5 hours, try use unithreadtimer on server module but no luck , it's never triger my function to   clear database session

Link to comment
Share on other sites

8 minutes ago, wilton_rad said:

because you do not clear database sessions when your unigui server starts, 
so if you drop your server, starting will clear all pending connections.

Which event on unigui , for trigering server start /unigui start

Link to comment
Share on other sites

On 7/30/2019 at 1:56 PM, donlego said:

Which event on unigui , for trigering server start /unigui start

In the UniServerModule.Create event you can clear all active sessions in the db.

 

Link to comment
Share on other sites

On 8/2/2019 at 12:37 AM, Ron said:

In the UniServerModule.Create event you can clear all active sessions in the db.

 

 

can't do this ,

coz i should not clear all session with  user still connected to the system, need to count active session/user logged & active

 

Link to comment
Share on other sites

46 minutes ago, donlego said:

 

can't do this ,

coz i should not clear all session with  user still connected to the system, need to count active session/user logged & active

 

But, when ServerModule Create, there is not user connected, or I'm wrong?

 

 

Link to comment
Share on other sites

12 hours ago, picyka said:

When you create ServerModule you have no one connected to the system, as there is only one ServerModule instantiated, so when creating you can clear this table without problems.

thanks ron & picyka  , it work i used on the server module on create to clear all left session ,

but not in the hyperserver mode ,

coz  with hyperserver , every user opened the url/app it trigering the oncreate servermodule which delete all active session

Link to comment
Share on other sites

21 minutes ago, eduardosuruagy said:

I also need this, since it's been a long time since I've been asking for this and nobody answers. Unfortunately...

Yap request on first hyper server release, and i can't create cloud sas with many user/company without session list

Link to comment
Share on other sites

OK, I realize it could be a problem with the hyperserver, as new servermodules might be created at new client connections.

Then you need to clear the sessions list when you start or restart the hyperserver, i.e. the IIS or Apache which runs the hyperserver.

I use a script which triggers a webserver restart each night at 2AM, and this also restarts the dbserver.

In such a script you could clear the db sessions table before starting the webserver.

But having the option of triggering an event at hyperserver first init would be nice, as requested.

Link to comment
Share on other sites

  • 5 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...