Skip to content

Commit

Permalink
Fix task manager query to also return tasks to retry
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecote committed Apr 13, 2020
1 parent 36b4ad9 commit 64f5060
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
RangeFilter,
mustBeAllOf,
MustCondition,
MustNotCondition,
BoolClauseWithAnyCondition,
} from './query_clauses';

export const TaskWithSchedule: ExistsFilter = {
Expand Down Expand Up @@ -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' } } },
],
},
};
Expand Down

0 comments on commit 64f5060

Please sign in to comment.