Skip to content

Commit

Permalink
remove queue specific options
Browse files Browse the repository at this point in the history
  • Loading branch information
bekzod committed Mar 23, 2019
1 parent 4950e09 commit cc1d212
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/backburner/deferred-action-queues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class DeferredActionQueues {
this.queueNames = queueNames;

queueNames.reduce(function(queues, queueName) {
queues[queueName] = new Queue(queueName, options[queueName], options);
queues[queueName] = new Queue(queueName, options);
return queues;
}, this.queues);
}
Expand Down
17 changes: 3 additions & 14 deletions lib/backburner/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ const QUEUE_ITEM_LENGTH = 4;

export default class Queue {
private name: string;
private globalOptions: any;
private options: any;
private _queueBeingFlushed: any[] = [];
private targetQueues = new Map();
private index = 0;
private _queue: any[] = [];

constructor(name: string, options: any = {}, globalOptions: any = {}) {
constructor(name: string, options: any = {}) {
this.name = name;
this.options = options;
this.globalOptions = globalOptions;
}

public stackFor(index) {
Expand All @@ -38,7 +36,6 @@ export default class Queue {
}

public flush(sync?: Boolean) {
let { before, after } = this.options;
let target;
let method;
let args;
Expand All @@ -50,14 +47,10 @@ export default class Queue {
this._queue = [];
}

if (before !== undefined) {
before();
}

let invoke;
let queueItems = this._queueBeingFlushed;
if (queueItems.length > 0) {
let onError = getOnError(this.globalOptions);
let onError = getOnError(this.options);
invoke = onError ? this.invokeWithOnError : this.invoke;

for (let i = this.index; i < queueItems.length; i += QUEUE_ITEM_LENGTH) {
Expand Down Expand Up @@ -88,16 +81,12 @@ export default class Queue {
}

if (this.index !== this._queueBeingFlushed.length &&
this.globalOptions.mustYield && this.globalOptions.mustYield()) {
this.options.mustYield && this.options.mustYield()) {
return QUEUE_STATE.Pause;
}
}
}

if (after !== undefined) {
after();
}

this._queueBeingFlushed.length = 0;
this.index = 0;
if (sync !== false && this._queue.length > 0) {
Expand Down

0 comments on commit cc1d212

Please sign in to comment.