App-RoboBot

 view release on metacpan or  search on metacpan

lib/App/RoboBot/Plugin/Bot/Alarm.pm  view on Meta::CPAN

    $message->response->push(sprintf('The alarm "%s" has been suspended.', $name));
    return;
}

sub _get_alarm {
    my ($self, $bot, $alarm_id) = @_;

    # We buffer the comparison of the current next_emit to now() by a little bit
    # into the future to account for the possibility of timer drift, and any
    # other delays that may occur between when the timer is schedule to fire and
    # when our bot's single execution thread finally reaches this point. One
    # minute is a major buffer, but alarms cannot be scheduled to trigger more
    # than a few times each hour anyway.
    my $res = $bot->config->db->do(q{
        select a.*,
            case
                when a.next_emit <= (now() + interval '1 minute') then 1
                else 0
            end as do_recalc
        from alarms_alarms a
        where a.id = ?



( run in 0.518 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )