Class: Appsignal::IPC::Server

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.uriObject (readonly)

Returns the value of attribute uri.



15
16
17
# File 'lib/appsignal/ipc.rb', line 15

def uri
  @uri
end

Class Method Details

.enqueue(transaction) ⇒ Object



34
35
36
37
# File 'lib/appsignal/ipc.rb', line 34

def enqueue(transaction)
  Appsignal.logger.debug("Receiving transaction #{transaction.request_id} in IPC server")
  Appsignal.enqueue(transaction)
end

.startObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/appsignal/ipc.rb', line 17

def start
  local_tmp_path = File.join(Appsignal.config.root_path, 'tmp')
  if File.exists?(local_tmp_path)
    @uri = 'drbunix:' + File.join(local_tmp_path, "appsignal-#{Process.pid}")
  else
    @uri = "drbunix:/tmp/appsignal-#{Process.pid}"
  end

  Appsignal.logger.info("Starting IPC server, listening on #{uri}")
  DRb.start_service(uri, Appsignal::IPC::Server)
end

.stopObject



29
30
31
32
# File 'lib/appsignal/ipc.rb', line 29

def stop
  Appsignal.logger.debug('Stopping IPC server')
  DRb.stop_service
end