diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-14 15:08:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-14 15:08:03 +0300 |
commit | 61a82b8ec062d6f122dadd38783c7754cef7ce2b (patch) | |
tree | 071d1ded4f507d77bac97156aa1fa85c95c0cba5 /lib/gitlab/cluster | |
parent | 3ed578edf525bce3167860b84f6b43bab5065cf5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/cluster')
-rw-r--r-- | lib/gitlab/cluster/lifecycle_events.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/gitlab/cluster/lifecycle_events.rb b/lib/gitlab/cluster/lifecycle_events.rb index be08ada9d2f..b39d2a02f02 100644 --- a/lib/gitlab/cluster/lifecycle_events.rb +++ b/lib/gitlab/cluster/lifecycle_events.rb @@ -63,6 +63,15 @@ module Gitlab # # Sidekiq/Puma Single: This is called immediately. # + # - on_worker_stop (on worker process): + # + # Puma Cluster: Called in the worker process + # exactly once after it stops processing requests + # but before it shuts down. + # + # Sidekiq: Called after the scheduler shuts down but + # before the worker finishes ongoing jobs. + # # Blocks will be executed in the order in which they are registered. # class LifecycleEvents @@ -113,6 +122,10 @@ module Gitlab end end + def on_worker_stop(&block) + (@worker_stop_hooks ||= []) << block + end + # # Lifecycle integration methods (called from puma.rb, etc.) # @@ -137,6 +150,10 @@ module Gitlab call(:master_restart_hooks, @master_restart_hooks) end + def do_worker_stop + call(:worker_stop_hooks, @worker_stop_hooks) + end + # DEPRECATED alias_method :do_master_restart, :do_before_master_restart |