Sha256: 273af1ee36156857ee5278bb758267e1457e59a75adf7b2d74b117ba0abb0eba
Contents?: true
Size: 781 Bytes
Versions: 23
Compression:
Stored size: 781 Bytes
Contents
module DeadlySerious module Processes class ResilientSplitter def initialize @reallocate = false Signal.trap('USR1') do @reallocate = true end end def run(readers: [], writers: []) reader = readers.first outputs = writers.dup current = nil reader.each do |line| begin if @reallocate @reallocate = false outputs = writers.dup end current = outputs.first current << line outputs.rotate! rescue Errno::EPIPE => e puts e.inspect outputs.delete(current) raise e if outputs.empty? redo end end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems