Fix task manager query to return tasks to retry (#63360) (#63405)

* Fix task manager query to also return tasks to retry

* Fix failing jest tests
This commit is contained in:
Mike Côté 2020-04-13 19:02:58 -04:00 committed by GitHub
parent e68fe90c85
commit 051d9f6dce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -11,7 +11,7 @@ import {
RangeFilter,
mustBeAllOf,
MustCondition,
MustNotCondition,
BoolClauseWithAnyCondition,
} from './query_clauses';
export const TaskWithSchedule: ExistsFilter = {
@ -54,15 +54,16 @@ export const IdleTaskWithExpiredRunAt: MustCondition<TermFilter | RangeFilter> =
},
};
export const InactiveTasks: MustNotCondition<TermFilter | RangeFilter> = {
// TODO: Fix query clauses to support this
export const InactiveTasks: BoolClauseWithAnyCondition<any> = {
bool: {
must_not: [
{
bool: {
should: [{ term: { 'task.status': 'running' } }, { term: { 'task.status': 'claiming' } }],
must: { range: { 'task.retryAt': { gt: 'now' } } },
},
},
{ range: { 'task.retryAt': { gt: 'now' } } },
],
},
};

View file

@ -407,9 +407,9 @@ describe('TaskStore', () => {
{ term: { 'task.status': 'running' } },
{ term: { 'task.status': 'claiming' } },
],
must: { range: { 'task.retryAt': { gt: 'now' } } },
},
},
{ range: { 'task.retryAt': { gt: 'now' } } },
],
},
},
@ -553,9 +553,9 @@ describe('TaskStore', () => {
{ term: { 'task.status': 'running' } },
{ term: { 'task.status': 'claiming' } },
],
must: { range: { 'task.retryAt': { gt: 'now' } } },
},
},
{ range: { 'task.retryAt': { gt: 'now' } } },
],
},
},