summaryrefslogtreecommitdiff
path: root/lib/Multi
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Multi')
-rw-r--r--lib/Multi/Maintenance.pm14
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;