Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Better formatting of populate_info_table/1.
Browse files Browse the repository at this point in the history
  • Loading branch information
archaelus committed Jan 25, 2012
1 parent e2bfc29 commit 049b997
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/logplex_shard.erl
Expand Up @@ -168,18 +168,22 @@ lookup_urls() ->
end.

populate_info_table(Urls) ->
%% Populate Read pool
Pools = add_pools(Urls, []),
{ok, Map1, Interval1} =
redis_shard:generate_map_and_interval(lists:sort(Pools)),
logplex_shard_info:save(logplex_read_pool_map, Map1, Interval1),

RedisBuffers = [{logplex_queue:get(Pid, redis_url), Pid}
|| {_Id, Pid, worker, _Modules}
<- supervisor:which_children(logplex_redis_buffer_sup)],
%% Populate write pool
RedisBuffers =
[{logplex_queue:get(Pid, redis_url), Pid}
|| {_Id, Pid, worker, _Modules}
<- supervisor:which_children(logplex_redis_buffer_sup)],
{ok, Map2, Interval2} =
redis_shard:generate_map_and_interval(lists:sort(RedisBuffers)),

logplex_shard_info:save(logplex_read_pool_map, Map1, Interval1),
logplex_shard_info:save(logplex_redis_buffer_map, Map2, Interval2),

ok.

add_pools([], Acc) -> Acc;
Expand Down

0 comments on commit 049b997

Please sign in to comment.