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

Queue only runs 0 or 1 task per refresh interval per worker #124

Open
danpalmer opened this issue Aug 6, 2023 · 1 comment
Open

Queue only runs 0 or 1 task per refresh interval per worker #124

danpalmer opened this issue Aug 6, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@danpalmer
Copy link

Describe the bug

The queues package is only able to run up to 1 task per refresh interval, per worker. For example, a system configured with 1 worker and a 10 second refresh interval, running tasks that take 1 second, cannot be utilised beyond 10%, and cannot run more than 1 task every 10 seconds.

To Reproduce

In a project with queues and a task configured...

  1. Set the number of workers to 1
  2. Set the refresh interval to 10 seconds
  3. Enqueue 10 tasks.

Expected behaviour
All 10 tasks complete one after the other with effectively zero gap between them.

Actual behaviour
The first task completes, and the queue waits until 10 seconds have elapsed before running the next.

Environment

queues 1.12.1
vapor-queues-fluent-driver 3.0.0-beta1

Additional context

I'm not sure whether this is worth filing on the fluent driver repo as well. I think there are two possible scenarios here:

  1. queues intends that the pop method in the driver API blocks until a job is available, likely intended for use with BRPOPLPUSH/etc on Redis. Therefore making this a "bug" in vapor-queues-fluent-driver or the queues documentation.
  2. (and/or) This is unintentional behaviour in queues, and it should instead re-pop if any job is run until there is nothing.

While the intention of refreshInterval isn't documented (that I can tell), I think it's most reasonable and would be most expected by those who have used other queueing systems, that it be a period to wait when there is no available work so the tuning of this value only impacts the polling of storage and does not impact the utilisation of queue workers.

@danpalmer danpalmer added the bug Something isn't working label Aug 6, 2023
@danpalmer
Copy link
Author

@0xTim hey, what do you think of this? Is this a bug in the queues package, or a bug in the fluent driver due to a mismatch in expectations. Or, am I just using it wrong!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant