Yeah, the intended logic could be better written.

while !session_created?
  select(nil,nil,nil,1)
end

But I would register a timeout maybe and let the user decide how long to wait.

Just my 2c.