Ruby

Ruby

Made by DeepSource

IO.select with single argument detected RB-DS1003

Bug risk
Major

IO.select statements can get very hard to make them compatible with Ruby 3 scheduler. It is recommended to use wait_readable or wait_writable on an IO object with a given timeout instead of rescuing an IO::WaitReadable or IO::WaitWritable error and using IO.select in the block.

Bad practice

IO.select([io], [], [], timeout)

Recommended

io.wait_readable(timeout)

Bad practice

IO.select([], [io], [], timeout)

Recommended

io.wait_writable(timeout)

References

  1. RuboCop Issue #9061
  2. Redis PR #960