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

Configure workers run by rake sneakers:run #444

Merged

Conversation

l-schirrmeister
Copy link

Adds the possibility to configure the workers, run by rake sneakers:run through Sneakers.rake_worker_classes

It will use still the workers from ENV[WORKERS]
But you can delete that and instead set Sneakers.rake_worker_classes = [Class1, Class2, ...] or set something that responds to :call.
If nothing is set, still Sneakers::Classes are used.

We have the situation that we would like to set the classes run by the task directly from within our project through a setting and not use an ENV for it, since that must be known from outside of it.
On the other hand, we use a base class for our workers so that the default strategy with Sneakers::Classes is not working for us as well.

Lars Schirrmeister added 2 commits July 24, 2020 16:43
…un through Sneakers.rake_worker_classes

It will use still the workers from ENV[WORKERS]
But you can delete that and instead set Sneakers.rake_worker_classes = [Class1, Class2, ...] or set something that responds to :call.
If nothing is set, still Sneakers::Classes are used.
@sharshenov
Copy link
Contributor

Hey @l-schirrmeister,

Have you tried passing a proc to a Sneakers::Runner?

require 'sneakers/runner'

workers_proc = -> { [Foo, Bar, Baz] }

r = Sneakers::Runner.new(workers_proc)
r.run

Details

@michaelklishin michaelklishin merged commit d761dfe into jondot:master Apr 11, 2022
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 this pull request may close these issues.

3 participants