Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1fe139e1b0 | |||
| 59d30bbb0f | |||
| 6ce18a5477 | |||
| 89c08068dd | |||
| 5f2e2b09cf |
@@ -1 +1 @@
|
|||||||
4.3.2
|
4.4.4
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
Notable changes to the esqueue project. Pay attention to `[BREAKING]` changes when upgrading.
|
Notable changes to the esqueue project. Pay attention to `[BREAKING]` changes when upgrading.
|
||||||
|
|
||||||
|
## v0.4.1
|
||||||
|
|
||||||
|
- Use `filter` instead of `must` to query for outstanding jobs
|
||||||
|
|
||||||
## v0.4.0
|
## v0.4.0
|
||||||
|
|
||||||
- [BREAKING] Change `priority` mapping to *byte*
|
- [BREAKING] Change `priority` mapping to *byte*
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "esqueue",
|
"name": "esqueue",
|
||||||
"version": "0.4.0",
|
"version": "0.4.1",
|
||||||
"description": "Job queue, powered by Elasticsearch",
|
"description": "Job queue, powered by Elasticsearch",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -235,11 +235,11 @@ export default class Job extends events.EventEmitter {
|
|||||||
constant_score: {
|
constant_score: {
|
||||||
filter: {
|
filter: {
|
||||||
bool: {
|
bool: {
|
||||||
must: { term: { jobtype: this.jobtype } },
|
filter: { term: { jobtype: this.jobtype } },
|
||||||
should: [
|
should: [
|
||||||
{ term: { status: 'pending'} },
|
{ term: { status: 'pending'} },
|
||||||
{ bool:
|
{ bool:
|
||||||
{ must: [
|
{ filter: [
|
||||||
{ term: { status: 'processing' } },
|
{ term: { status: 'processing' } },
|
||||||
{ range: { process_expiration: { lte: nowTime } } }
|
{ range: { process_expiration: { lte: nowTime } } }
|
||||||
] }
|
] }
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ describe('Job Class', function () {
|
|||||||
const job = new Job(client, index, type, payload, optionals);
|
const job = new Job(client, index, type, payload, optionals);
|
||||||
return Promise.resolve(client.get({}, optionals))
|
return Promise.resolve(client.get({}, optionals))
|
||||||
.then((doc) => {
|
.then((doc) => {
|
||||||
console.log('mocked doc', doc);
|
|
||||||
sinon.stub(client, 'get').returns(Promise.resolve(doc));
|
sinon.stub(client, 'get').returns(Promise.resolve(doc));
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
@@ -231,8 +231,7 @@ describe('Worker class', function () {
|
|||||||
it('should search by job type', function () {
|
it('should search by job type', function () {
|
||||||
const { body } = getSearchParams(jobtype);
|
const { body } = getSearchParams(jobtype);
|
||||||
const conditions = get(body, conditionPath);
|
const conditions = get(body, conditionPath);
|
||||||
expect(conditions).to.have.property('must');
|
expect(conditions.filter).to.eql({ term: { jobtype: jobtype } });
|
||||||
expect(conditions.must).to.eql({ term: { jobtype: jobtype } });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for pending or expired jobs', function () {
|
it('should search for pending or expired jobs', function () {
|
||||||
@@ -243,7 +242,7 @@ describe('Worker class', function () {
|
|||||||
// this works because we are stopping the clock, so all times match
|
// this works because we are stopping the clock, so all times match
|
||||||
const nowTime = moment().toISOString();
|
const nowTime = moment().toISOString();
|
||||||
const pending = { term: { status: 'pending'} };
|
const pending = { term: { status: 'pending'} };
|
||||||
const expired = { bool: { must: [
|
const expired = { bool: { filter: [
|
||||||
{ term: { status: 'processing' } },
|
{ term: { status: 'processing' } },
|
||||||
{ range: { process_expiration: { lte: nowTime } } }
|
{ range: { process_expiration: { lte: nowTime } } }
|
||||||
] } };
|
] } };
|
||||||
|
|||||||
Reference in New Issue
Block a user