File tree Expand file tree Collapse file tree 1 file changed +3
-20
lines changed Expand file tree Collapse file tree 1 file changed +3
-20
lines changed Original file line number Diff line number Diff line change @@ -159,36 +159,19 @@ def pool.checkout(options)
159
159
super
160
160
end
161
161
162
- did_something = false
163
-
164
162
action = lambda do
165
- Timeout . timeout ( 0.02 ) do
163
+ Timeout . timeout ( 0.01 ) do
166
164
pool . with do |obj |
167
- did_something = true
168
165
# Timeout::Error will be triggered by any non-trivial Ruby code
169
166
# executed here since it couldn't be raised during checkout.
170
- # It looks like setting the local variable above does not trigger
167
+ # It looks like setting a local variable does not trigger
171
168
# the Timeout check in MRI 2.2.1.
172
169
obj . tap { obj . hash }
173
170
end
174
171
end
175
172
end
176
173
177
- if RUBY_ENGINE == "ruby"
178
- # These asserts rely on the Ruby implementation reaching `did_something =
179
- # true` before the interrupt is detected by the thread. Interrupt
180
- # detection timing is implementation-specific in practice, with JRuby,
181
- # Rubinius, and TruffleRuby all having different interrupt timings to MRI.
182
- # In fact they generally detect interrupts more quickly than MRI, so they
183
- # may not reach `did_something = true` before detecting the interrupt.
184
-
185
- assert_raises Timeout ::Error , &action
186
-
187
- assert did_something
188
- else
189
- action . call
190
- end
191
-
174
+ assert_raises Timeout ::Error , &action
192
175
assert_equal 1 , pool . available
193
176
end
194
177
You can’t perform that action at this time.
0 commit comments