Sha256: f012a4addbdd57d91a78ee438309305076930f6a5c782895d2be95077705fb84

Contents?: true

Size: 657 Bytes

Versions: 5

Compression:

Stored size: 657 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require '../lib/async/container/controller'
require '../lib/async/container/forked'

Async.logger.debug!

Async.logger.debug(self, "Starting up...")

controller = Async::Container::Controller.new do |container|
	Async.logger.debug(self, "Setting up container...")
	
	container.run(count: 1, restart: true) do
		Async.logger.debug(self, "Child process started.")
		
		while true
			sleep 1
			
			if rand < 0.1
				exit(1)
			end
		end
	ensure
		Async.logger.debug(self, "Child process exiting:", $!)
	end
end

begin
	controller.run
ensure
	Async.logger.debug(controller, "Parent process exiting:", $!)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
async-container-0.16.5 examples/container.rb
async-container-0.16.4 examples/container.rb
async-container-0.16.3 examples/container.rb
async-container-0.16.2 examples/container.rb
async-container-0.16.1 examples/container.rb