Ignore jobs started over 50 minutes ago (setting: jobs_stale_after)
This commit is contained in:
6
Changes
6
Changes
@@ -1,3 +1,9 @@
|
||||
2.038007
|
||||
|
||||
[ENHANCEMENTS]
|
||||
|
||||
* Ignore jobs started over 50 minutes ago (setting: jobs_stale_after)
|
||||
|
||||
2.038006
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
@@ -154,6 +154,7 @@ sub jq_getsome {
|
||||
job => $job->id,
|
||||
-exists => $jobs->search({
|
||||
status => { -like => 'queued-%' },
|
||||
started => \[q/> (now() - ?::interval)/, setting('jobs_stale_after')],
|
||||
%job_properties,
|
||||
})->as_query,
|
||||
}],
|
||||
@@ -170,8 +171,10 @@ sub jq_getsome {
|
||||
|
||||
sub jq_locked {
|
||||
my @returned = ();
|
||||
my $rs = schema('netdisco')->resultset('Admin')
|
||||
->search({ status => ('queued-'. setting('workers')->{'BACKEND'}) });
|
||||
my $rs = schema('netdisco')->resultset('Admin')->search({
|
||||
status => ('queued-'. setting('workers')->{'BACKEND'}),
|
||||
started => \[q/> (now() - ?::interval)/, setting('jobs_stale_after')],
|
||||
});
|
||||
|
||||
while (my $job = $rs->next) {
|
||||
push @returned, App::Netdisco::Backend::Job->new({ $job->get_columns });
|
||||
@@ -197,7 +200,10 @@ sub jq_lock {
|
||||
try {
|
||||
my $updated = schema('netdisco')->resultset('Admin')
|
||||
->search({ job => $job->id, status => 'queued' }, { for => 'update' })
|
||||
->update({ status => ('queued-'. setting('workers')->{'BACKEND'}) });
|
||||
->update({
|
||||
status => ('queued-'. setting('workers')->{'BACKEND'}),
|
||||
started => \"now()",
|
||||
});
|
||||
|
||||
$happy = true if $updated > 0;
|
||||
}
|
||||
|
||||
@@ -284,6 +284,9 @@ workers:
|
||||
retry_after: '7 days'
|
||||
queue: PostgreSQL
|
||||
|
||||
# 50 minutes
|
||||
jobs_stale_after: 3000
|
||||
|
||||
dns:
|
||||
max_outstanding: 50
|
||||
hosts_file: '/etc/hosts'
|
||||
|
||||
Reference in New Issue
Block a user