Revision ee71ba33
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/DB/Manager/BackgroundJob.pm | ||
---|---|---|
15 | 15 |
} |
16 | 16 |
|
17 | 17 |
sub get_all_need_to_run { |
18 |
my $class = shift; |
|
19 |
return $class->get_all(where => [ and => [ active => 1, next_run_at => { le => DateTime->now_local } ] ]); |
|
18 |
my $class = shift; |
|
19 |
|
|
20 |
my $now = DateTime->now_local; |
|
21 |
my @interval_args = (and => [ type => 'interval', |
|
22 |
active => 1, |
|
23 |
next_run_at => { le => $now } ]); |
|
24 |
my @once_args = (and => [ type => 'once', |
|
25 |
active => 1, |
|
26 |
last_run_at => undef, |
|
27 |
or => [ cron_spec => undef, |
|
28 |
cron_spec => '', |
|
29 |
next_run_at => undef, |
|
30 |
next_run_at => { le => $now } ] ]); |
|
31 |
|
|
32 |
return $class->get_all(where => [ or => [ @interval_args, @once_args ] ]); |
|
20 | 33 |
} |
21 | 34 |
|
22 | 35 |
1; |
Auch abrufbar als: Unified diff
Hintergrundjobs: DB-Model und allgemeine Modelimplementation mit ersten Test-Jobs