You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
q.push(function (cb) {
const result = 'two'
cb(null, result)
})
I would like it to support queuing only unique items like so:
var q = queue({ results: [], unique: true })
The API would then work as follows;
// item added to queue as normal (still works)
q.push(function (cb) {
const result = 'two'
cb(null, result)
})
// item added to queue with an id - if unique is true then the id must be unique or else the job is ignored
const id = 'my-id'
q.push(id, function (cb) {
const result = 'two'
cb(null, result)
})
// job ignored coz same id used
q.push(id, function (cb) {
const result = 'two'
cb(null, result)
})
Please consider this request - thanks
Note that this request would benefit the developer, allowing the library to support:
q.getJobsWaiting() // array of ids that refer to jobs waiting to be processed, order by time job added
q.getJobsProcessing() // array of ids that refer to jobs currently running, order by time job added
q.getJobsComplete() // array of ids that refer to completed jobs that were resolved, order by time job added
q.getJobsFailed() // array of ids that refer to completed jobs that were rejected, order by time job added
If IDs were not given then these methods would simply return empty arrays.
The text was updated successfully, but these errors were encountered:
my 2 cents. For better backwards compatibility, the signature of push(fn) function should remain unchanged. To pass named task(job with id) to the queue, we could allow the following:
import{Task},queuefrom'queue'classMyTaskextendsTask{publicasyncrun(){// job implementation here...}}constq=queue()q.push(MyTask)// effective, queue size 1q.push(MyTask)// not effective, queue size still 1
This library is almost perfect for my needs.
Currently queue works like so:
I would like it to support queuing only unique items like so:
var q = queue({ results: [], unique: true })
The API would then work as follows;
Please consider this request - thanks
Note that this request would benefit the developer, allowing the library to support:
If IDs were not given then these methods would simply return empty arrays.
The text was updated successfully, but these errors were encountered: