anchor.diff:      {_, State0} = try_connect(Node, State),
       {noreply, State0};
   
  +handle_info(persist, State) ->
  +    lager:debug("persisting known nodes now"),
  +    persist_nodes(State#state.nodes),
  +
  +    {noreply, State#state{persist_timer=undefined}};
  +
   handle_info(Info, State) ->
       lager:warning("discoverer: unhandled message ~p", [Info]),
       {noreply, State}.
  
positive.code:                     % publish new/updated node
                      gen_server:cast(self(), {publish, Node}),
  
                      {true, State#state{nodes=Ns0}};
                  false ->
                      lager:warning("connecting to node ~p failed", [Node]),
                      {false, State};
  
negative.code:                     {ignored, State}
              end
      end.
  
  
  %%
  %% TESTS
  %%
  
  -ifdef(TEST).
  
  persist_nodes_test_() ->
      MkNode = fun(N) -> {N, #node_info{node=N}} end,
      Nodes = maps:from_list(lists:map(MkNode, [statser@foo, statser@bar])),
  
      [?_assertEqual(ok, persist_nodes(maps:new())),
       ?_assertEqual(ok, persist_nodes(Nodes))
      ].
  
  load_nodes_test_() ->
      MkNode = fun(N) -> {N, #node_info{node=N}} end,
      Nodes = maps:from_list(lists:map(MkNode, [statser@foo, statser@bar])),
      PersistAndLoad = fun(Xs) ->
                               ok = persist_nodes(Xs),
                               load_nodes()
                       end,
  
      [?_assertEqual([], load_nodes(<<"/tmp/probably/does/not/exist.json">>)),
       ?_assertEqual(Nodes, PersistAndLoad(Nodes))
      ].
  
  -endif.
  