diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-06 15:09:05 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-06 15:09:05 +0000 |
commit | c79da5142f46e6e9187f75c329e2c81a8568c581 (patch) | |
tree | e1411c6a9b22582f91bfbca947c343d0b36cf11a /lib | |
parent | 2e31a394c5857fdb845811685ca7fc79a2fb7540 (diff) | |
download | gitlab-ce-c79da5142f46e6e9187f75c329e2c81a8568c581.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/daemon.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/gitlab/daemon.rb b/lib/gitlab/daemon.rb index 5f579f90629..04d13778499 100644 --- a/lib/gitlab/daemon.rb +++ b/lib/gitlab/daemon.rb @@ -2,10 +2,20 @@ module Gitlab class Daemon - def self.initialize_instance(...) - raise "#{name} singleton instance already initialized" if @instance + # Options: + # - recreate: We usually only allow a single instance per process to exist; + # this can be overridden with this switch, so that existing + # instances are stopped and recreated. + def self.initialize_instance(*args, recreate: false, **options) + if @instance + if recreate + @instance.stop + else + raise "#{name} singleton instance already initialized" + end + end - @instance = new(...) + @instance = new(*args, **options) Kernel.at_exit(&@instance.method(:stop)) @instance end |