开发者

Spring Webflow in Grails keeping plenty of hibernate sessions open

开发者 https://www.devze.com 2022-12-28 09:36 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号