Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/cluster/lifecycle_events.rb')
-rw-r--r--lib/gitlab/cluster/lifecycle_events.rb17
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