Class: HubSsoLib::Server::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/hub_sso_lib.rb

Constant Summary collapse

QUEUE =
::Queue.new

Class Method Summary collapse

Class Method Details

.runObject



784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
# File 'lib/hub_sso_lib.rb', line 784

def self.run
  puts "Server: Starting at #{ HUB_CONNECTION_URI }" if ENV['HUB_QUIET_SERVER'].nil?

  @@hub_session_factory = HubSsoLib::SessionFactory.new

  Signal.trap('INT' ) { QUEUE << :INT  }
  Signal.trap('TERM') { QUEUE << :TERM }

  DRb.start_service(HUB_CONNECTION_URI, @@hub_session_factory, { :safe_level => 1 })

  QUEUE.pop

  self.shutdown()
  exit

rescue => e
  Sentry.capture_exception(e) if defined?(Sentry) && Sentry.respond_to?(:capture_exception)
  raise
end

.shutdownObject



804
805
806
807
808
809
810
811
# File 'lib/hub_sso_lib.rb', line 804

def self.shutdown
  puts "Server: Graceful shutdown..."

  @@hub_session_factory.dump_sessions!
  DRb.stop_service

  puts "Server: ...completed."
end