29
29
-export ([handle_call /3 ]).
30
30
-export ([handle_cast /2 ]).
31
31
-export ([handle_info /2 ]).
32
+ -export ([handle_continue /2 ]).
32
33
33
34
% config_listener callbacks
34
35
-export ([handle_config_change /5 ]).
@@ -44,27 +45,26 @@ host_header() ->
44
45
45
46
init (_ ) ->
46
47
URL = nouveau_util :nouveau_url (),
47
- case start_gun (URL ) of
48
- {ok , _PoolPid } ->
49
- ok = config :listen_for_changes (? MODULE , URL ),
50
- {ok , nil };
51
- {error , Reason } ->
52
- {error , Reason }
53
- end .
48
+ ok = config :listen_for_changes (? MODULE , URL ),
49
+ {ok , URL , {continue , start_gun }}.
54
50
55
51
handle_call (_Msg , _From , State ) ->
56
52
{reply , unexpected_msg , State }.
57
53
58
54
handle_cast (_Msg , State ) ->
59
55
{noreply , State }.
60
56
61
- handle_info (restart_config_listener , State ) ->
62
- ok = config :listen_for_changes (? MODULE , nil ),
63
- {noreply , State };
64
- handle_info (Msg , State ) ->
65
- couch_log :warning (" ~p received unexpected message: ~p " , [? MODULE , Msg ]),
57
+ handle_info (_Msg , State ) ->
66
58
{noreply , State }.
67
59
60
+ handle_continue (start_gun , URL ) ->
61
+ case start_gun (URL ) of
62
+ {ok , _ManagerPid } ->
63
+ {noreply , URL };
64
+ {error , Reason } ->
65
+ {stop , Reason }
66
+ end .
67
+
68
68
handle_config_change (" nouveau" , " url" , URL , _Persist , OldURL ) ->
69
69
case start_gun (URL ) of
70
70
{ok , _PoolPid } ->
0 commit comments