Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the current queue length ? #3

Open
vidur149 opened this issue Feb 6, 2018 · 3 comments
Open

How to get the current queue length ? #3

vidur149 opened this issue Feb 6, 2018 · 3 comments

Comments

@vidur149
Copy link

vidur149 commented Feb 6, 2018

No description provided.

@alykoshin
Copy link
Owner

I just exposed private queue object as a property of middleware function. Please, update to latest version. You can get length with following:

const express = require('express');
const expressQueue = require('express-queue');
const queueMw = expressQueue({ activeLimit: 2, queuedLimit: -1 });

const app = express();
app.use(queueMw);

console.log(`queueLength: ${queueMw.queue.getLength()}`);

@dreamgear
Copy link

When I try to touch queueMw.queue express hangs up on me with the requires as above. In the main README above it says "const expressQueue = require('../');" which doesn't make any sense to me, and doesn't work anyway. It would be very useful to me if I could look at the queue length.

When I run the demo I get "Error: Cannot find module '../'".

@alykoshin
Copy link
Owner

"const expressQueue = require('../');"

This code wass copied from examples/app.js and refers to this module as contained in parent directory.

In actual application you need to use

const expressQueue = require('express-queue');

Fixed it at README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants