debian-mirror-gitlab/lib/gitlab/cluster/mixins/puma_cluster.rb

24 lines
642 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# 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-12-26 22:10:19 +05:30
# This looks at internal status of `Puma::Cluster`
# https://github.com/puma/puma/blob/v3.12.1/lib/puma/cluster.rb#L333
2019-12-21 20:55:43 +05:30
def stop_workers
2019-12-26 22:10:19 +05:30
if @status == :stop # rubocop:disable Gitlab/ModuleWithInstanceVariables
Gitlab::Cluster::LifecycleEvents.do_before_graceful_shutdown
end
2019-12-21 20:55:43 +05:30
super
end
end
end
end
end