File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,16 @@ defmodule Meilisearch do
78
78
79
79
use GenServer
80
80
81
- defp to_name ( name ) , do: :"__MODULE__:#{ name } "
81
+ def child_spec ( opts ) do
82
+ name = Keyword . fetch! ( opts , :name )
83
+
84
+ % {
85
+ id: name ,
86
+ start: { __MODULE__ , :start_link , [ opts ] }
87
+ }
88
+ end
89
+
90
+ defp to_name ( name ) , do: :"#{ inspect ( __MODULE__ ) } :#{ name } "
82
91
83
92
@ spec start_link ( atom ( ) ,
84
93
endpoint: String . t ( ) ,
@@ -91,9 +100,8 @@ defmodule Meilisearch do
91
100
do: start_link ( [ name: name ] ++ opts )
92
101
93
102
def start_link ( opts ) when is_list ( opts ) do
94
- with { :ok , name } <- Keyword . fetch ( opts , :name ) do
95
- GenServer . start_link ( __MODULE__ , opts , name: to_name ( name ) )
96
- end
103
+ name = Keyword . fetch! ( opts , :name )
104
+ GenServer . start_link ( __MODULE__ , opts , name: to_name ( name ) )
97
105
end
98
106
99
107
@ impl true
You can’t perform that action at this time.
0 commit comments