Class: ActiveJob::Temporal::WorkerPool::ProcessAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/activejob/temporal/worker_pool.rb

Instance Method Summary collapse

Instance Method Details

#fork(environment, command) ⇒ Object



370
371
372
373
374
375
# File 'lib/activejob/temporal/worker_pool.rb', line 370

def fork(environment, command)
  Process.fork do
    environment.each { |key, value| ENV[key] = value }
    exec(*command)
  end
end

#fork_supported?Boolean

Returns:

  • (Boolean)


397
398
399
# File 'lib/activejob/temporal/worker_pool.rb', line 397

def fork_supported?
  Process.respond_to?(:fork)
end

#kill(signal, pid) ⇒ Object



389
390
391
# File 'lib/activejob/temporal/worker_pool.rb', line 389

def kill(signal, pid)
  Process.kill(signal, pid)
end

#sleep(duration) ⇒ Object



393
394
395
# File 'lib/activejob/temporal/worker_pool.rb', line 393

def sleep(duration)
  Kernel.sleep(duration)
end

#wait(pids) ⇒ Object



377
378
379
380
381
382
383
# File 'lib/activejob/temporal/worker_pool.rb', line 377

def wait(pids)
  if pids.is_a?(Integer)
    Process.wait2(pids)
  else
    wait_for_any(pids)
  end
end

#wait_nonblock(pid) ⇒ Object



385
386
387
# File 'lib/activejob/temporal/worker_pool.rb', line 385

def wait_nonblock(pid)
  Process.wait(pid, Process::WNOHANG)
end