Skip to content

Commit

Permalink
Use Thread#join without a duration
Browse files Browse the repository at this point in the history
* Time varies a lot in CI, using a duration is making tests more flaky.
  • Loading branch information
eregon committed Nov 17, 2023
1 parent 2a65de5 commit dbcf6f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/lint/streams.rb
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def test_xread_does_not_raise_timeout_error_when_the_block_option_is_zero_msec
Thread.pass until prepared
redis2 = init _new_client
redis2.xadd('s1', { f: 'v1' }, id: '0-1')
thread.join(3)
thread.join

assert_equal(['v1'], actual.fetch('s1').map { |i| i.last['f'] })
end
Expand Down
6 changes: 3 additions & 3 deletions test/redis/publish_subscribe_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def teardown
end
redis.close
begin
thread.join(2) or warn("leaked thread")
thread.join
rescue RedisClient::ConnectionError
end
end
Expand Down Expand Up @@ -296,7 +296,7 @@ def test_unsubscribe_from_another_thread
assert_empty @messages

@subscribed_redis.unsubscribe # this shouldn't block
refute_nil thread.join(2)
thread.join
assert_equal true, @unsubscribed
end

Expand Down Expand Up @@ -329,7 +329,7 @@ def test_subscribe_from_another_thread
@subscribed_redis.unsubscribe(channel_name)
@subscribed_redis.unsubscribe # this shouldn't block

refute_nil thread.join(2)
thread.join
expected = [
["subscribed", channel_name],
["message", channel_name, "test"],
Expand Down

0 comments on commit dbcf6f3

Please sign in to comment.