refactor: split list comprehension over fn calls

This commit is contained in:
Thales Macedo Garitezi 2022-11-08 09:58:05 -03:00
parent c23c534525
commit ca973db2fc
1 changed files with 15 additions and 6 deletions

View File

@ -180,9 +180,18 @@ ensure_timer(URL, State = #state{refresh_timers = RefreshTimers0}, Timeout) ->
State#state{refresh_timers = RefreshTimers}.
collect_urls(Listeners) ->
lists:usort([URL
|| #{proto := ssl, opts := Opts} <- Listeners,
{crl_options, CRLOpts} <- Opts,
proplists:get_bool(crl_cache_enabled, CRLOpts),
{crl_cache_urls, URLs} <- CRLOpts,
URL <- URLs]).
CRLOpts0 = [CRLOpts || #{proto := ssl, opts := Opts} <- Listeners,
{crl_options, CRLOpts} <- Opts],
CRLOpts1 =
lists:filter(
fun(CRLOpts) ->
proplists:get_bool(crl_cache_enabled, CRLOpts)
end,
CRLOpts0),
CRLURLs =
lists:flatmap(
fun(CRLOpts) ->
proplists:get_value(crl_cache_urls, CRLOpts, [])
end,
CRLOpts1),
lists:usort(CRLURLs).