I have an Internet app running on Grails 1.1.2 and it integrates Spring WebFlow mechanism. The problem is that there are some bots ignoring robots.txt and are entering the flow quite often.
Because second step of the flow needs some human intelli开发者_如何学Pythongence, the bot leaves open flow after the first step. This causes a lot of open flows which leades to a lot of abandoned open hibernate sessions.
Do you know some common clean-up mechanism for this kind of unattended flows (plus hibernate sessions) in Grails+Spring WebFlow?
Thanks, Pavel
My first suggestion would be to require a captia in order to access the flow. If that isn't an option you could set a short session time in step one of the web flow, then reset it to something longer in step three. An example is step one
session.setMaxInactiveInterval(60);
step three
session.setMaxInactiveInterval(600);
This will cause any session in step one or two to die after 60 seconds of inactivity. When the session dies any hibernate sessions associated with the session will be cleaned up. Assuming the user completes steps one and two in fewer than 60 seconds they will have 10 minutes to complete each additional step.
精彩评论