X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FDB%2FManager%2FBackgroundJob.pm;h=1bb89ee7d73836ab7fc5ae2e703b572908963f26;hb=a16a706880ae7181ad723ceb44c76775c597b202;hp=1429a7856e00dd5d0c15072ea3fb79a1e3925fa3;hpb=0b2ca0abb53db0d372bcc51e8093abb30f2aeea6;p=kivitendo-erp.git diff --git a/SL/DB/Manager/BackgroundJob.pm b/SL/DB/Manager/BackgroundJob.pm index 1429a7856..1bb89ee7d 100644 --- a/SL/DB/Manager/BackgroundJob.pm +++ b/SL/DB/Manager/BackgroundJob.pm @@ -5,10 +5,17 @@ use strict; use SL::DB::Helper::Manager; use base qw(SL::DB::Helper::Manager); +use SL::DB::Helper::Sorted; + sub object_class { 'SL::DB::BackgroundJob' } __PACKAGE__->make_manager_methods; +sub _sort_spec { + return ( default => [ 'next_run_at', 1 ], + columns => { SIMPLE => 'ALL' } ); +} + sub cleanup { my $class = shift; $class->delete_all(where => [ and => [ type => 'once', last_run_at => { lt => DateTime->now_local->subtract(days => '1') } ] ]); @@ -29,7 +36,7 @@ sub get_all_need_to_run { next_run_at => undef, next_run_at => { le => $now } ] ]); - return $class->get_all(where => [ or => [ @interval_args, @once_args ] ]); + return $class->get_all(query => [ or => [ @interval_args, @once_args ] ]); } 1;