defmodule DeviceHandler.Sync.Device do alias DeviceHandler.Sync.Device.{Server} alias DeviceHandler.Sync.{HubRegistry} def new(interval, serial, options \\ []) do options = Keyword.put_new(options, :name, HubRegistry.name(serial)) GenServer.start_link(Server, [interval, serial], options) end def child_spec([]) do %{ id: __MODULE__, start: {__MODULE__, :new, [100]}, restart: :permanent, shutdown: 5000, type: :worker } end end