Chromesmith v0.0.1 Chromesmith View Source

Main module for Chromesmith.

Add Chromesmith to your application supervision tree:

defmodule ChromesmithExample.Application do
  use Application

  def start(_type, _args) do
    children = [
      Chromesmith.child_spec(:chrome_pool, [process_pool_size: 2, page_pool_size: 1])
    ]

    opts = [strategy: :one_for_one, name: ChromesmithExample.Supervisor]
    Supervisor.start_link(children, opts)
  end
end

Using Chromesmith.child_spec/2, you can provide multiple options to configure the pool:

  • :process_pool_size - How many Chrome instances to open
  • :page_pool_size - How many pages to open per chrome instance

Link to this section Summary

Link to this section Types

Link to this type t() View Source
t() :: %Chromesmith{checkout_queue: :queue.queue, page_pool_size: non_neg_integer, process_pool_size: non_neg_integer, process_pools: [{pid, [pid], [pid]}], supervisor: pid}

Link to this section Functions

Check in a Page that has completed work.

Link to this function checkout(pid, should_block \\ false) View Source
checkout(pid, boolean) ::
  {:ok, pid} |
  {:error, :none_available} |
  {:error, :timeout}

Check out a Page from one of the headless chrome processes.

Link to this function spawn_pools(supervisor, state) View Source
Link to this function start_link(opts, start_opts \\ []) View Source
Link to this function start_worker(supervisor, index, state) View Source