* pushWithKey a promisify-task to queue * @param id {string} * @param processingFunc {Function } * @returns {boolean} if success return true, otherwise false
(id, processingFunc)
| 70 | * @returns {boolean} if success return true, otherwise false |
| 71 | */ |
| 72 | push (id, processingFunc) { |
| 73 | if (this.queue.length >= this.max) return false |
| 74 | if (this.checkTaskIsInQueue(id)) return false |
| 75 | const task = { |
| 76 | id: id, |
| 77 | processingFunc: processingFunc |
| 78 | } |
| 79 | this.taskMap.set(id, true) |
| 80 | this.queue.push(task) |
| 81 | this.start() |
| 82 | this.emit(QueueEvent.Push) |
| 83 | return true |
| 84 | } |
| 85 | |
| 86 | process () { |
| 87 | if (this.queue.length <= 0) { |
no test coverage detected