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/daemon.rb')
-rw-r--r--lib/gitlab/daemon.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/gitlab/daemon.rb b/lib/gitlab/daemon.rb
index ddb9d907640..058fe1c8139 100644
--- a/lib/gitlab/daemon.rb
+++ b/lib/gitlab/daemon.rb
@@ -2,16 +2,16 @@
module Gitlab
class Daemon
- def self.initialize_instance(*args)
+ def self.initialize_instance(...)
raise "#{name} singleton instance already initialized" if @instance
- @instance = new(*args)
+ @instance = new(...)
Kernel.at_exit(&@instance.method(:stop))
@instance
end
- def self.instance(*args)
- @instance ||= initialize_instance(*args)
+ def self.instance(...)
+ @instance ||= initialize_instance(...)
end
attr_reader :thread
@@ -20,7 +20,8 @@ module Gitlab
!thread.nil?
end
- def initialize
+ def initialize(**options)
+ @synchronous = options[:synchronous]
@mutex = Mutex.new
end
@@ -43,6 +44,10 @@ module Gitlab
Thread.current.name = thread_name
run_thread
end
+
+ @thread.join if @synchronous
+
+ @thread
end
end
end