Skip to content

Commit

Permalink
Fix regression when --only option is used w/ --socket.
Browse files Browse the repository at this point in the history
  • Loading branch information
macournoyer committed May 21, 2009
1 parent bb3c6dd commit 95a060a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
== ? release
* Fix regression when --only option is used w/ --socket.
* Add process name 'tag' functionality. Easier to distinguish thin daemons
from eachother in process listing [ctcherry]

Expand Down
4 changes: 2 additions & 2 deletions lib/thin/controllers/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def run(cmd, number)

def with_each_server
if only
if only < 80
if first_port && only < 80
# interpret +only+ as a sequence number
yield(first_port + only)
yield first_port + only
else
# interpret +only+ as an absolute port number
yield only
Expand Down
23 changes: 23 additions & 0 deletions spec/controllers/cluster_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,29 @@ def options_for_port(port)
end
end

describe Cluster, "controlling only one server with UNIX socket" do
before do
@cluster = Cluster.new(:chdir => '/rails_app',
:socket => '/tmp/thin.sock',
:address => '0.0.0.0',
:port => 3000,
:servers => 3,
:timeout => 10,
:log => 'thin.log',
:pid => 'thin.pid',
:only => 1
)
end

it 'should call only specified server' do
calls = []
@cluster.send(:with_each_server) do |n|
calls << n
end
calls.should == [1]
end
end

describe Cluster, "controlling only one server, by sequence number" do
before do
@cluster = Cluster.new(:chdir => '/rails_app',
Expand Down

0 comments on commit 95a060a

Please sign in to comment.