You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "jaydoane (via GitHub)" <gi...@apache.org> on 2023/11/28 17:14:44 UTC
Re: [PR] Improve consistency of config after delete and reload, and tidy up [couchdb]
jaydoane commented on code in PR #4813:
URL: https://github.com/apache/couchdb/pull/4813#discussion_r1408113407
##########
src/config/src/config.erl:
##########
@@ -324,26 +337,15 @@ handle_call({delete, Sec, Key, Persist, Reason}, _From, Config) ->
{reply, Else, Config}
end;
handle_call(reload, _From, Config) ->
- DiskKVs = lists:foldl(
- fun(IniFile, DiskKVs0) ->
- {ok, ParsedIniValues} = parse_ini_file(IniFile),
- lists:foldl(
- fun({K, V}, DiskKVs1) ->
- dict:store(K, V, DiskKVs1)
- end,
- DiskKVs0,
- ParsedIniValues
- )
- end,
- dict:new(),
- Config#config.ini_files
- ),
- % Update ets with anything we just read
- % from disk
- dict:fold(
- fun({Sec, Key} = K, V, _) ->
+ IniMap = ini_map(Config#config.ini_files),
+ % Update ets with list values, and delete those with ?DELETE markers.
+ maps:foreach(
+ fun({Sec, Key} = K, V) ->
VExisting = get(Sec, Key, V),
- ets:insert(?MODULE, {K, V}),
+ case V =:= ?DELETE of
Review Comment:
Simplified to remove `=:=` in https://github.com/apache/couchdb/pull/4813/commits/44c3179bab08ff28aa07ad618944c8a2cc8a8bde
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org