diff options
author | Yorhel <git@yorhel.nl> | 2009-01-16 15:16:39 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-01-16 15:16:39 +0100 |
commit | 9ee7694a4b6f7dce174ec785cf5a71a5a38774bb (patch) | |
tree | 38e6dbb83d21dffec285f731fc1ae421e55801f5 /lib/Multi/Maintenance.pm | |
parent | 6dc9a434619d28f87eaf768b00d3696bb7c24c61 (diff) | |
parent | 910bb9f397cec1a49526e09e7d2c9b856bd5bdae (diff) |
Merge branch 'beta'2.2
Diffstat (limited to 'lib/Multi/Maintenance.pm')
-rw-r--r-- | lib/Multi/Maintenance.pm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Multi/Maintenance.pm b/lib/Multi/Maintenance.pm index 2fb7b2bd..e9c9b337 100644 --- a/lib/Multi/Maintenance.pm +++ b/lib/Multi/Maintenance.pm @@ -9,6 +9,7 @@ use strict; use warnings; use POE; use PerlIO::gzip; +use Time::HiRes 'gettimeofday', 'tv_interval'; sub spawn { @@ -17,7 +18,7 @@ sub spawn { my $p = shift; POE::Session->create( package_states => [ - $p => [qw| _start cmd_maintenance vncache usercache statscache revcache integrity unkanime logrotate |], + $p => [qw| _start cmd_maintenance vncache usercache statscache revcache integrity unkanime logrotate vnpopularity |], ], ); } @@ -25,10 +26,10 @@ sub spawn { sub _start { $_[KERNEL]->alias_set('maintenance'); - $_[KERNEL]->call(core => register => qr/^maintenance((?: (?:vncache|revcache|usercache|statscache|integrity|unkanime|logrotate))+)$/, 'cmd_maintenance'); + $_[KERNEL]->call(core => register => qr/^maintenance((?: (?:vncache|revcache|usercache|statscache|integrity|unkanime|logrotate|vnpopularity))+)$/, 'cmd_maintenance'); # Perform some maintenance functions every day on 0:00 - $_[KERNEL]->post(core => addcron => '0 0 * * *', 'maintenance vncache integrity unkanime'); + $_[KERNEL]->post(core => addcron => '0 0 * * *', 'maintenance vncache integrity unkanime vnpopularity'); # update caches and rotate logs every 1st day of the month at 0:05 $_[KERNEL]->post(core => addcron => '5 0 1 * *' => 'maintenance usercache statscache revcache logrotate'); } @@ -169,6 +170,13 @@ sub logrotate { } +sub vnpopularity { + my $S = [gettimeofday]; + $Multi::SQL->do(q|SELECT update_vnpopularity()|); + $_[KERNEL]->call(core => log => 3 => '(Re)calculated vn.c_popularity in %.2fs', tv_interval($S)); +} + + 1; |