Reputation: 11437
I am developing a HTML5 UI with JQuery and javascript libraries. The backend is a simple SQL Server db. During the users session a few files and DB tables can be created depending on what they are doing. If the user exits in a normal fashion these files and tables are removed as required.
However if the browser freezes or the user shuts it down via task manager then the I have a bunch of orphaned tables/files. Is there any standard method of cleaning up server side when the client crashes/ended unexpectedly?
Upvotes: 0
Views: 75
Reputation: 11437
I cant use time as a measurement of classifying invalid files unfortunately - i just dont know how long it should be idle for. Instead i will cleanup at start of every users session
Upvotes: 0
Reputation: 11316
You could store session id in these temporary tables and discard any data related with user session when it's idle for e.g. 30 minutes.
Again, you could store session temporary files in separate folder and simply delete this folder based on the same condition.
Simple script launched periodicaly should do the trick.
Upvotes: 1