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



357
358
359
360
361
362
# File 'lib/activejob/temporal/worker_pool.rb', line 357

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

#fork_supported?Boolean

Returns:

  • (Boolean)


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

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

#kill(signal, pid) ⇒ Object



376
377
378
# File 'lib/activejob/temporal/worker_pool.rb', line 376

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

#sleep(duration) ⇒ Object



380
381
382
# File 'lib/activejob/temporal/worker_pool.rb', line 380

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

#wait(pids) ⇒ Object



364
365
366
367
368
369
370
# File 'lib/activejob/temporal/worker_pool.rb', line 364

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

#wait_nonblock(pid) ⇒ Object



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

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