diff options
author | Magnus Ahltorp <map@kth.se> | 2015-10-01 15:09:33 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2015-11-11 13:32:37 +0100 |
commit | f7a0018fb849bf0baefbea4af16ce8ce61ec69d0 (patch) | |
tree | 3afb7bffe904a7dc065d1a1e44e98c89c76f2515 /src/frontend.erl | |
parent | 0a3e6aafee314eaf9e5343c4cad89a9e2ae1d913 (diff) |
Added util:parallel_map and use it when checking entries.
Diffstat (limited to 'src/frontend.erl')
-rw-r--r-- | src/frontend.erl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/frontend.erl b/src/frontend.erl index b7fa4b1..1055e5f 100644 --- a/src/frontend.erl +++ b/src/frontend.erl @@ -241,16 +241,17 @@ check_entries_int(Entries, Start, End) -> end, [], lists:zip(Entries, lists:seq(Start, End))). check_entries_noreverse(Entries, Start, End) -> - lists:foldl(fun ({Hash, Index}, Acc) -> - lager:info("checking entry ~p", [Index]), - case check_entry_noreverse(Hash, Index) of + Results = util:parallel_map(fun ({Hash, Index}) -> + check_entry_noreverse(Hash, Index) + end, lists:zip(Entries, lists:seq(Start, End)), 2), + lists:foldl(fun (Result, Acc) -> + case Result of ok -> - lager:info("entry ~p is correct", [Index]), Acc; Error -> [Error | Acc] end - end, [], lists:zip(Entries, lists:seq(Start, End))). + end, [], Results). entryhash_from_entry(Entry) -> {ok, {Module, Function}} = application:get_env(plop, entryhash_from_entry), |