Class: RRRSpec::Server::CLI
- Inherits:
-
Thor
- Object
- Thor
- RRRSpec::Server::CLI
- Defined in:
- lib/rrrspec/server/cli.rb
Instance Method Summary collapse
Instance Method Details
#server ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rrrspec/server/cli.rb', line 21 def server setup(ServerConfiguration.new) RRRSpec.configuration.daemonize = [:daemonize] unless [:daemonize] == nil RRRSpec.configuration.pidfile = [:pidfile] unless [:pidfile] == nil RRRSpec.configuration.user = [:user] unless [:user] == nil RRRSpec::Server.daemonizer('rrrspec-server server') do ActiveRecord::Base.establish_connection(**RRRSpec.configuration.persistence_db) Thread.abort_on_exception = true Thread.fork { Dispatcher.work_loop } Thread.fork { Arbiter.work_loop } Thread.fork { Persister.work_loop } Thread.fork { StatisticsUpdater.work_loop } Kernel.sleep end end |
#worker ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rrrspec/server/cli.rb', line 43 def worker setup(WorkerConfiguration.new) RRRSpec.configuration.daemonize = [:daemonize] unless [:daemonize] == nil RRRSpec.configuration.pidfile = [:pidfile] unless [:pidfile] == nil RRRSpec.configuration.user = [:user] unless [:user] == nil RRRSpec::Server.daemonizer('rrrspec-server worker') do worker = Worker.create([:'worker-type'] || RRRSpec.configuration.worker_type) worker_runner = WorkerRunner.new(worker) Thread.abort_on_exception = true Thread.fork { RRRSpec.pacemaker(worker, 60, 5) } Thread.fork { worker_runner.work_loop } Kernel.sleep end end |