forked from resque/resque
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Beside redis connection, all Resque configuration is needed only for worker class which is dispatched from CLI. This means the we actually don't need to keep this in class, it's was only there because of ENV support which is now solved in a different way, directly in Rake task. Defaults from config and CLI class were removed, there was no sense to set it in so many places. Worker's constructor is the place were default options for it should be set. Removed #load_config method, moved it's logic to CLI#initialize. CLI class, especially #work method, is much cleaner now.
- Loading branch information
Showing
7 changed files
with
78 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
redis: "" | ||
namespace: "" | ||
failure_backed: "" | ||
daemon: true | ||
failure_backend: "redis" | ||
fork_per_job: true | ||
interval: 1 | ||
timeout: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'test_helper' | ||
|
||
require 'resque/cli' | ||
|
||
describe Resque::CLI do | ||
it "#work" do | ||
cli = Resque::CLI.new([], ["-c", "test/fixtures/resque.yml", "-i", "666", "-q", "first,second", "-r", "path/to/file"]) | ||
w = mock("Resque::Worker") | ||
w.expects(:work) | ||
Resque::Worker.expects(:new).with(["first", "second"], {:timeout => 2, :interval => 666, :daemon => true}).returns(w) | ||
Resque::CLI.any_instance.expects(:load_enviroment).with("path/to/file") | ||
cli.invoke(:work) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters