Skip to content

Container example doesn't actually initialize anything #15

Open
@tadman

Description

@tadman

The container example runs without doing anything:

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

Where the output is:

0.11s: Object
      | Starting up...
 0.11s: Async::Container::Notify::Console
      | {:status=>"Initializing..."}
 0.11s: Async::Container::Controller
      | Starting container...
 0.11s: Async::Container::Controller
      | Waiting for startup...
 0.11s: Async::Container::Forked
      | Waiting for ready:
 0.11s: Async::Container::Controller
      | Finished startup.
 0.11s: Async::Container::Notify::Console
      | {:ready=>true}
 0.11s: Async::Container::Controller
      | Parent process exiting:

There's no mention of a "Child process" in there because the block is ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions