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

Bug: RateLimiter properties bounceBack is not work, And test is not run #2719

Open
lzj960515 opened this issue Apr 10, 2024 · 0 comments
Open

Comments

@lzj960515
Copy link

Description

it('should not put a job into the delayed queue when discard is true', () => {
const newQueue = utils.buildQueue('test rate limiter', {
limiter: {
max: 1,
duration: 1000,
bounceBack: true
}
});
newQueue.on('failed', e => {
assert.fail(e);
});
return Promise.all([
newQueue.add({}),
newQueue.add({}),
newQueue.add({}),
newQueue.add({})
]).then(() => {
Promise.all([
newQueue.getNextJob({}),
newQueue.getNextJob({}),
newQueue.getNextJob({}),
newQueue.getNextJob({})
]).then(() => {
return newQueue.getDelayedCount().then(delayedCount => {
expect(delayedCount).to.eq(0);
return newQueue.getActiveCount().then(waitingCount => {
expect(waitingCount).to.eq(1);
});
});
});
});
});

This Promise not return, So it not run. And waitingCount is expect 3, but is 0.

Promise.all([
newQueue.getNextJob({}),
newQueue.getNextJob({}),
newQueue.getNextJob({}),
newQueue.getNextJob({})
]).then(() => {
return newQueue.getDelayedCount().then(delayedCount => {
expect(delayedCount).to.eq(0);
return newQueue.getActiveCount().then(waitingCount => {
expect(waitingCount).to.eq(1);
});

Bull version

4.12.2

Additional information

Please fix the bug.

@lzj960515 lzj960515 changed the title RateLimiter properties bounceBack is not work, And test is not run Bug: RateLimiter properties bounceBack is not work, And test is not run Apr 10, 2024
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

1 participant