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



865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
# File 'lib/hub_sso_lib.rb', line 865

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

  @@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



885
886
887
888
889
890
891
892
# File 'lib/hub_sso_lib.rb', line 885

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

  @@hub_session_factory.dump_sessions!
  DRb.stop_service

  puts "Server: ...completed."
end