From f7a0018fb849bf0baefbea4af16ce8ce61ec69d0 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Thu, 1 Oct 2015 15:09:33 +0200 Subject: Added util:parallel_map and use it when checking entries. --- src/frontend.erl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/frontend.erl') 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), -- cgit v1.1