Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> = {
Copy link
Contributor Author

@mikecote mikecote Apr 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not manage to get query clause TS types working within a timebox, deferring to later.

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
4 changes: 2 additions & 2 deletions x-pack/plugins/task_manager/server/task_store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' } } },
],
},
},
Expand Down Expand Up @@ -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' } } },
],
},
},
Expand Down