Adding metadata and replace support#9
Conversation
…arch) Added replace function to update future job
package.json
Outdated
| { | ||
| "name": "yajob", | ||
| "version": "2.1.2", | ||
| "version": "2.1.3", |
There was a problem hiding this comment.
Do not update version in PR please. This changes likely to be a minor update.
|
Why just not store mails.put({
from: 'floatdrop@gmail.com',
to: 'nodejs-dev@dev-null.com',
meta: {body: 'You have 1 new notification'}
}, {
schedule: d
});Remove functionality will not be affected (or I misunderstanding something). |
|
Well, maybe I didn't understand the remove fully. Consider your example, and this: mails.remove({
from: 'floatdrop@gmail.com',
to: 'nodejs-dev@dev-null.com'
});Would this remove the entry without specifying the meta parameter? If so, you are right, I don't need the meta. The whole point of the PR was to allow the following:
(I'll close this PR and submit just the replace if this is the case) |
|
Right, that doesn't work. Consider this test (that fails): test('removes job with partial attr match', async t => {
const queueDb = await new QueueDb();
const queue = yajob(queueDb.uri);
try {
await queue.put({test: 'wow', param: 1});
await queue.remove({test: 'wow'});
const jobs = await queueDb.db.collection('default').find().toArray();
t.is(jobs.length, 0, 'should remove job from queue');
} finally {
await queueDb.close();
}
});Let me clean up my PR and see what you think |
|
@drmikecrowe sorry for late response – I am quite sure, that right way is to add option |
|
I tried to get the remove function to work with the meta Field in the The only way I was able to get it to work, was to have the metadata in a What I've committed now is actually solid and I'm starting to use it in my
|
Two new features: