File: timeout_in_threads.rb

package info (click to toggle)
ruby-parallel 1.22.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 464 kB
  • sloc: ruby: 1,930; makefile: 4
file content (11 lines) | stat: -rw-r--r-- 217 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
# frozen_string_literal: true
require './spec/cases/helper'
require 'timeout'

Parallel.each([1], in_threads: 1) do |_i|
  Timeout.timeout(0.1) { sleep 0.2 }
rescue Timeout::Error
  puts "OK"
else
  puts "BROKEN"
end