module Tus::Input::Unicorn
Extension for Unicorn
to gracefully handle interrupted uploads.
Public Instance Methods
read(length = nil, outbuf = nil)
click to toggle source
Rescues Unicorn::ClientShutdown exception when reading, and instead of failing just returns blank data to signal end of input.
Calls superclass method
# File lib/tus/input/unicorn.rb, line 7 def read(length = nil, outbuf = nil) super rescue => exception raise unless exception.class.name == "Unicorn::ClientShutdown" outbuf = outbuf.to_s.clear outbuf unless length end