MCPcopy Create free account
hub / github.com/coopernurse/node-pool / enqueue

Method enqueue

lib/PriorityQueue.js:28–39  ·  view source on GitHub ↗
(obj, priority)

Source from the content-addressed store, hash-verified

26 }
27
28 enqueue(obj, priority) {
29 // Convert to integer with a default value of 0.
30 priority = (priority && +priority | 0) || 0;
31
32 if (priority) {
33 if (priority < 0 || priority >= this._size) {
34 priority = this._size - 1;
35 // put obj at the end of the line
36 }
37 }
38 this._slots[priority].push(obj);
39 }
40
41 dequeue() {
42 for (let i = 0, sl = this._slots.length; i < sl; i += 1) {

Callers 1

acquireMethod · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected