2019-10-16 11:06:17 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Cluster
|
|
|
|
module Mixins
|
|
|
|
module PumaCluster
|
|
|
|
def self.prepended(base)
|
|
|
|
raise 'missing method Puma::Cluster#stop_workers' unless base.method_defined?(:stop_workers)
|
|
|
|
end
|
|
|
|
|
2019-10-30 05:27:58 -04:00
|
|
|
# This looks at internal status of `Puma::Cluster`
|
|
|
|
# https://github.com/puma/puma/blob/v3.12.1/lib/puma/cluster.rb#L333
|
2019-10-16 11:06:17 -04:00
|
|
|
def stop_workers
|
2019-10-30 05:27:58 -04:00
|
|
|
if @status == :stop # rubocop:disable Gitlab/ModuleWithInstanceVariables
|
|
|
|
Gitlab::Cluster::LifecycleEvents.do_before_graceful_shutdown
|
|
|
|
end
|
2019-10-16 11:06:17 -04:00
|
|
|
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|