diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-07-01 15:32:19 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-07-01 15:32:19 +0000 |
commit | 606261e8e7d6d7879a2b88c3c217df08b063c9fc (patch) | |
tree | c1a6dd029360ea2d8c2dd3225ce26beccaf6caf5 /config/unicorn.rb.example.development | |
parent | 59963779362b00723d79ae6190689ad0fccf729e (diff) | |
download | gitlab-ce-606261e8e7d6d7879a2b88c3c217df08b063c9fc.tar.gz |
Run do_master_restart callback on server start
We want to call master_restart callback on start too - this callback
is used for cleaning up prometheus files. It has been added to
Omnibus already:
https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests/3350
So make sure that Unicorn example configs are up-to-date and that
the same callback is called for Puma too.
Diffstat (limited to 'config/unicorn.rb.example.development')
-rw-r--r-- | config/unicorn.rb.example.development | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/config/unicorn.rb.example.development b/config/unicorn.rb.example.development index ae3dc2e37e1..9a02d5f1007 100644 --- a/config/unicorn.rb.example.development +++ b/config/unicorn.rb.example.development @@ -21,9 +21,21 @@ before_exec do |server| Gitlab::Cluster::LifecycleEvents.do_master_restart end +run_once = true + before_fork do |server, worker| - # Signal application hooks that we're about to fork - Gitlab::Cluster::LifecycleEvents.do_before_fork + if run_once + # There is a difference between Puma and Unicorn: + # - Puma calls before_fork once when booting up master process + # - Unicorn runs before_fork whenever new work is spawned + # To unify this behavior we call before_fork only once (we use + # this callback for deleting Prometheus files so for our purposes + # it makes sense to align behavior with Puma) + run_once = false + + # Signal application hooks that we're about to fork + Gitlab::Cluster::LifecycleEvents.do_before_fork + end # The following is only recommended for memory/DB-constrained # installations. It is not needed if your system can house |