Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/puma/plugin/solid_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,8 @@ def puma_dead?

def log(...)
log_writer.log(...)
rescue Errno::EIO
# The controlling terminal can disappear before the monitor thread shuts
# down the child process. Keep shutdown moving even when logging cannot.
end
end
22 changes: 22 additions & 0 deletions test/unit/puma_plugin_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

require "test_helper"
require "puma/plugin/solid_queue"

class PumaPluginTest < ActiveSupport::TestCase
class ClosedTerminalLogWriter
def log(...)
raise Errno::EIO
end
end

test "monitor still stops the process when shutdown logging fails" do
plugin = Puma::Plugins.find("solid_queue").new
plugin.instance_variable_set(:@log_writer, ClosedTerminalLogWriter.new)

plugin.stubs(:puma_dead?).returns(true)
Process.expects(:kill).with(:INT, Process.pid)

plugin.send(:monitor, :puma_dead?, "Detected Puma has gone away, stopping Solid Queue...")
end
end
Loading