- public unshiftTask (task: Task<Data>): number {
- const tasksQueueSize = this.tasksQueue.unshift(task)
- if (this.hasBackPressure() && !this.onBackPressureStarted) {
- this.onBackPressureStarted = true
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.emit('backPressure', { workerId: this.info.id! })
- this.onBackPressureStarted = false
- }
- return tasksQueueSize
- }
-
- /** @inheritdoc */
- public dequeueTask (): Task<Data> | undefined {
- return this.tasksQueue.shift()
- }
-
- /** @inheritdoc */
- public popTask (): Task<Data> | undefined {
- return this.tasksQueue.pop()
+ public dequeueTask (bucket?: number): Task<Data> | undefined {
+ return this.tasksQueue.dequeue(bucket)