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

"Job received" Event #124

Closed
lp-wodell opened this issue May 22, 2019 · 5 comments
Closed

"Job received" Event #124

lp-wodell opened this issue May 22, 2019 · 5 comments

Comments

@lp-wodell
Copy link

Would be great to have an event that fired when a job is received by the bottleneck. Our code is sending to a single instance of a bottleneck from a large variety of places and modules which makes this hard to track.

If there is an existing way to do this then please let me know!

@SGrondin
Copy link
Owner

That's a great idea and it's easy to implement. I'll do it this weekend!

@lp-wodell
Copy link
Author

Now that is service! Thank you so much.

@SGrondin
Copy link
Owner

SGrondin commented Jun 1, 2019

Sorry for the delay! It took me some time last weekend to realize that it was better to make this feature local to a limiter inside a Cluster. Once I realized that, it didn't take much time to implement.

Bottleneck 2.19.0 adds the following events: received, queued, scheduled, executing and done. They map to Jobs Lifecycle transitions. 🎉

For your use case, you would use either received or queued, depending on your needs.

received is triggered immediately and for every schedule()/submit()/wrapped() call.

queued is triggered after the limiter has validated the current queue size against the highWaterMark option. This event happens almost immediately after received, but it will not be triggered if the job is not accepted into the queue.

Please let me know how it works for you!

@SGrondin SGrondin closed this as completed Jun 1, 2019
@lp-wodell
Copy link
Author

Thank you Simon! I think others will find this very useful too where a bottleneck instance can be accessed from lots of different points in the code.

@SGrondin
Copy link
Owner

SGrondin commented Jun 3, 2019

I agree, it's such an obvious feature in retrospect that I'm surprised I didn't think about it and no one suggested it earlier.

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

No branches or pull requests

2 participants