Foorum::TheSchwartz::Worker::Every15Min - For those cron jobs every 15 minutes


Foorum documentation Contained in the Foorum distribution.

Index


Code Index:

NAME

Top

Foorum::TheSchwartz::Worker::Every15Min - For those cron jobs every 15 minutes

SYNOPSIS

Top

  # check bin/cron/TheSchwartz_client.pl and bin/cron/TheSchwartz_worker.pl for usage

DESCRIPTION

Top

remove user_online with where last_time < time() - 1200

SEE ALSO

Top

TheSchwartz

AUTHOR

Top

Fayland Lam <fayland at gmail.com>


Foorum documentation Contained in the Foorum distribution.

package Foorum::TheSchwartz::Worker::Every15Min;

use strict;
use warnings;
our $VERSION = '1.001000';
use base qw( TheSchwartz::Moosified::Worker );
use Data::Dump qw/dump/;
use Foorum::SUtils qw/schema/;
use Foorum::Logger qw/error_log/;

sub work {
    my $class = shift;
    my $job   = shift;

    my @args = $job->arg;

    my $schema = schema();

    # remove user_online data
    $schema->resultset('UserOnline')
        ->search( { last_time => { '<', time() - 1200 }, } )->delete;

    $job->completed();
}

1;
__END__