Created
September 22, 2017 16:17
-
-
Save adkron/2b585ce4118e11cb22231df8a87ebc14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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