Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 0ed0482

Browse files
committed
Fix Set size querying
1 parent cc042f9 commit 0ed0482

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/client/request-queue/enqueue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* is not accepting any requests.
1515
*/
1616
module.exports = function enqueue (message, expect, emitter, cb) {
17-
if (this._queue.length >= this.size || this._frozen) {
17+
if (this._queue.size >= this.size || this._frozen) {
1818
return false
1919
}
2020

test/lib/client/request-queue/enqueue.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ const { test } = require('tap')
44
const enqueue = require('../../../../lib/client/request-queue/enqueue')
55

66
test('rejects new requests if size is exceeded', async t => {
7-
const q = { _queue: { length: 5 }, size: 5 }
7+
const q = { _queue: { size: 5 }, size: 5 }
88
const result = enqueue.call(q, 'foo', 'bar', {}, {})
99
t.notOk(result)
1010
})
1111

1212
test('rejects new requests if queue is frozen', async t => {
13-
const q = { _queue: { length: 0 }, size: 5, _frozen: true }
13+
const q = { _queue: { size: 0 }, size: 5, _frozen: true }
1414
const result = enqueue.call(q, 'foo', 'bar', {}, {})
1515
t.notOk(result)
1616
})
1717

1818
test('adds a request and returns if no timeout', async t => {
1919
const q = {
2020
_queue: {
21-
length: 0,
21+
size: 0,
2222
add (obj) {
2323
t.same(obj, {
2424
message: 'foo',
@@ -38,7 +38,7 @@ test('adds a request and returns if no timeout', async t => {
3838
test('adds a request and returns timer not set', async t => {
3939
const q = {
4040
_queue: {
41-
length: 0,
41+
size: 0,
4242
add (obj) {
4343
t.same(obj, {
4444
message: 'foo',
@@ -61,7 +61,7 @@ test('adds a request, returns true, and clears queue', t => {
6161
t.plan(4)
6262
const q = {
6363
_queue: {
64-
length: 0,
64+
size: 0,
6565
add (obj) {
6666
t.same(obj, {
6767
message: 'foo',

0 commit comments

Comments
 (0)