Permalink
Browse files

Start the watch manager with the app

  • Loading branch information...
1 parent cbed719 commit 57211dfba18318e1f4e26613723844ed2277601e @mitchellh committed Apr 26, 2012
@@ -15,6 +15,7 @@
{mod, { lifeguard_app, []}},
{env, [
{data_sources, [{"garbage", lifeguard_ds_garbage, []}]},
+ {storage_path, "/tmp/lifeguard.db"},
{js_vm_count, 8}
]}
]}.
@@ -24,8 +24,9 @@ start_link() ->
init([]) ->
% Get the data sources from the application configuration
- {ok, JsVMCount} = application:get_env(js_vm_count),
{ok, DataSources} = application:get_env(data_sources),
+ {ok, JsVMCount} = application:get_env(js_vm_count),
+ {ok, StoragePath} = application:get_env(storage_path),
% Run the data store manager supervisor
DSManager = {data_store_manager_sup,
@@ -37,6 +38,11 @@ init([]) ->
{lifeguard_js_manager_sup, start_link, [JsVMCount]},
permanent, 30000, supervisor, dynamic},
+ % Watch manager
+ WatchManager = {watch_manager,
+ {lifeguard_watch_manager, start_link, [StoragePath]},
+ permanent, 30000, worker, dynamic},
+
% Return the full spec
- Children = [DSManager, JsManager],
+ Children = [DSManager, JsManager, WatchManager],
{ok, { {one_for_one, 5, 10}, Children} }.
@@ -18,6 +18,8 @@ init(StoragePath) ->
{auto_save, 60000}
]),
+ % Log it out and start
+ lager:info("Watch manager started. Storage path: ~p", [StoragePath]),
{ok, no_state}.
handle_call(_Request, _From, State) -> {noreply, State}.
@@ -27,6 +29,7 @@ handle_cast(_Request, State) -> {noreply, State}.
handle_info(_Request, State) -> {noreply, State}.
terminate(_Reason, _State) ->
+ lager:info("Watch manager terminated."),
ok = dets:close(table).
code_change(_OldVsn, State, _Extra) -> {ok, State}.

0 comments on commit 57211df

Please sign in to comment.