Skip to content

Commit

Permalink
Fix no_timeout option handling.
Browse files Browse the repository at this point in the history
[ #2840 ]
  • Loading branch information
durran committed Feb 20, 2013
1 parent a4ef64c commit 1f28fde
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ For instructions on upgrading to newer versions, visit

* \#2848 Fixed `touch` to work when usinng short timestamps. (Arthur Neves)

* \#2840 Fixed end-to-end `no_timeout` option handling.

## 3.1.1

### Resolved Issues
Expand Down
3 changes: 3 additions & 0 deletions lib/mongoid/contextual/mongo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ def apply_options
[ :hint, :limit, :skip, :sort, :batch_size, :max_scan ].each do |name|
apply_option(name)
end
if criteria.options[:timeout] == false
query.no_timeout
end
end

# Apply an option.
Expand Down
6 changes: 5 additions & 1 deletion spec/mongoid/contextual/mongo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@
describe "#initialize" do

let(:criteria) do
Band.where(name: "Depeche Mode")
Band.where(name: "Depeche Mode").no_timeout
end

let(:context) do
Expand All @@ -781,6 +781,10 @@
it "sets the query selector" do
context.query.selector.should eq({ "name" => "Depeche Mode" })
end

it "sets timeout options" do
context.query.operation.flags.should eq([ :no_cursor_timeout ])
end
end

describe "#last" do
Expand Down

0 comments on commit 1f28fde

Please sign in to comment.