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

Feature request: Immediately start a job #71

Open
bugs181 opened this issue May 28, 2020 · 2 comments · May be fixed by #73
Open

Feature request: Immediately start a job #71

bugs181 opened this issue May 28, 2020 · 2 comments · May be fixed by #73

Comments

@bugs181
Copy link

bugs181 commented May 28, 2020

Looking to be able to able to start a job immediately, skipping concurrency and other limits.

bugs181 added a commit to bugs181/queue that referenced this issue May 31, 2020
@bugs181 bugs181 linked a pull request May 31, 2020 that will close this issue
@jessetane
Copy link
Owner

I'm probably missing something but if no queue features are needed, why not call the function directly?

@bugs181
Copy link
Author

bugs181 commented Jun 7, 2020

There are several reasons why I've chosen to go this route. First, you get a simpler codebase by structuring your application to use the provided events. This keeps users from rewriting code for different path handling. In my case, I have an addQueue function which all client requests go to. Depending on which request it is, it may get flagged for immediate use (an example is req info) while others get queued up for processing at a later time.

Furthermore, it's a much simpler codebase by being able to write code to use job info like IDs and such.

Edit:

I'm probably missing something but if no queue features are needed

Several queue features are still in use here. Namely, being able to have timeouts, events, job information, etc. The only feature not being used is concurrency limit. We want most jobs to respect concurrency limits (an example is bulk processing) whilst other jobs may not be resource intensive thus can run immediately. One workaround is to use two instances of Queue however this has the disadvantage of having duplicate code and multiple code paths.

Please see pull request #73 for an example. The work is also already provided for you with minimal changes.

Does this answer your question? Willing to provide some concrete examples.

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

Successfully merging a pull request may close this issue.

2 participants