From 2bda6076a93e45c259148f0723fff37cd5aa56dc Mon Sep 17 00:00:00 2001 From: Yorhel Date: Tue, 26 Jan 2010 20:18:47 +0100 Subject: Automatically remove sessions that haven't been used for a month --- lib/Multi/Maintenance.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Multi/Maintenance.pm b/lib/Multi/Maintenance.pm index 864239dd..be267aba 100644 --- a/lib/Multi/Maintenance.pm +++ b/lib/Multi/Maintenance.pm @@ -17,12 +17,12 @@ sub spawn { package_states => [ $p => [qw| _start shutdown set_daily daily set_monthly monthly log_stats - vncache_inc tagcache vnpopularity vnrating cleangraphs + vncache_inc tagcache vnpopularity vnrating cleangraphs cleansessions vncache_full usercache statscache logrotate |], ], heap => { - daily => [qw|vncache_inc tagcache vnpopularity vnrating cleangraphs|], + daily => [qw|vncache_inc tagcache vnpopularity vnrating cleangraphs cleansessions|], monthly => [qw|vncache_full usercache statscache logrotate|], @_, }, @@ -151,6 +151,13 @@ sub cleangraphs { } +sub cleansessions { + $_[KERNEL]->post(pg => do => + q|DELETE FROM sessions WHERE lastused < NOW()-'1 month'::interval|, + undef, 'log_stats', 'cleansessions'); +} + + # # M O N T H L Y J O B S # -- cgit v1.2.3