diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-03-25 16:07:43 -0500 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-04-10 16:30:49 -0500 |
commit | 3c0a017b63b31b1e8d62707c0b909d8f24def1ba (patch) | |
tree | b3611a6e13a8bcf39403b754b9a44075b841eaa9 | |
parent | 247b80997fc2b1777606746c6b4ec4eaa48ad352 (diff) | |
download | couchdb-3c0a017b63b31b1e8d62707c0b909d8f24def1ba.tar.gz |
Move process_db/1 to match the logical progression
Functions are easier to read and process if they're defined in the order
that they are referenced.
Co-Authored-By: Nick Vatamaniuc <vatamane@apache.org>
-rw-r--r-- | src/fabric/src/fabric2_index.erl | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/fabric/src/fabric2_index.erl b/src/fabric/src/fabric2_index.erl index 098d6edd4..8d0affebb 100644 --- a/src/fabric/src/fabric2_index.erl +++ b/src/fabric/src/fabric2_index.erl @@ -155,6 +155,16 @@ process_updates_iter([Db | Rest], Cont) -> process_updates_iter(Rest, Cont). +process_db(DbName) when is_binary(DbName) -> + {ok, Db} = fabric2_db:open(DbName, [?ADMIN_CTX]), + fabric2_fdb:transactional(Db, fun(TxDb) -> + DDocs1 = get_design_docs(TxDb), + DDocs2 = lists:filter(fun should_update/1, DDocs1), + DDocs3 = shuffle(DDocs2), + build_indices(TxDb, DDocs3) + end). + + build_indices(_TxDb, []) -> []; @@ -168,16 +178,6 @@ registrations() -> application:get_env(fabric, indices, []). -process_db(DbName) when is_binary(DbName) -> - {ok, Db} = fabric2_db:open(DbName, [?ADMIN_CTX]), - fabric2_fdb:transactional(Db, fun(TxDb) -> - DDocs1 = get_design_docs(TxDb), - DDocs2 = lists:filter(fun should_update/1, DDocs1), - DDocs3 = shuffle(DDocs2), - build_indices(TxDb, DDocs3) - end). - - get_design_docs(Db) -> Callback = fun ({meta, _}, Acc) -> {ok, Acc}; |