Skip to content

Instantly share code, notes, and snippets.

@adkron
Created Sep 22, 2017
Embed
What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment