Skip to content

Commit 3cf1433

Browse files
committed
Fixed broken ActorRef #post! timeout spec.
1 parent 9395f6a commit 3cf1433

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

lib/concurrent/actor/simple_actor_ref.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def post(*msg, &block)
3737
end
3838

3939
def post!(timeout, *msg)
40-
raise Concurrent::TimeoutError if timeout <= 0
40+
raise Concurrent::TimeoutError unless timeout.nil? || timeout >= 0
4141
ivar = self.post(*msg)
4242
ivar.value(timeout)
4343
if ivar.incomplete?

spec/concurrent/actor/actor_ref_shared.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,7 @@ def receive(*msg)
164164

165165
it 'blocks forever when the timeout is nil' do
166166
start = Time.now.to_f
167-
begin
168-
subject.post!(nil, :sleep, 1)
169-
rescue
170-
end
167+
subject.post!(nil, :sleep, 1)
171168
delta = Time.now.to_f - start
172169
delta.should > 1
173170
end

0 commit comments

Comments
 (0)