Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/snowflake.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ defmodule Snowflake do
use Application

def start(_type, _args) do
import Supervisor.Spec

children = [
worker(Snowflake.Generator, [Snowflake.Helper.epoch(), Snowflake.Helper.machine_id()])
{Snowflake.Generator, [Snowflake.Helper.epoch(), Snowflake.Helper.machine_id()]}
]

Supervisor.start_link(children, strategy: :one_for_one)
Expand Down
2 changes: 1 addition & 1 deletion lib/snowflake/generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Snowflake.Generator do
@machine_id_overflow 1024
@seq_overflow 4096

def start_link(epoch, machine_id) when machine_id < @machine_id_overflow do
def start_link([epoch, machine_id]) when machine_id < @machine_id_overflow do
state = {epoch, ts(epoch), machine_id, 0}
GenServer.start_link(__MODULE__, state, name: __MODULE__)
end
Expand Down