- public unshiftTask (task: Task<Data>): number {
- const tasksQueueSize = this.tasksQueue.unshift(task)
- if (this.onBackPressure != null && this.hasBackPressure()) {
- this.onBackPressure(this.info.id as number)
- }
- return tasksQueueSize
- }
-
- /** @inheritdoc */
- public dequeueTask (): Task<Data> | undefined {
- const task = this.tasksQueue.shift()
- if (this.onEmptyQueue != null && this.tasksQueue.size === 0) {
- this.startOnEmptyQueue().catch(EMPTY_FUNCTION)
- }
- return task
- }
-
- /** @inheritdoc */
- public popTask (): Task<Data> | undefined {
- const task = this.tasksQueue.pop()
- if (this.onEmptyQueue != null && this.tasksQueue.size === 0) {
- this.startOnEmptyQueue().catch(EMPTY_FUNCTION)
- }
- return task
+ public dequeueTask (bucket?: number): Task<Data> | undefined {
+ return this.tasksQueue.dequeue(bucket)