Yes, I would very much like delete_config too. It'd do the same for me.

On Thu, Dec 9, 2021 at 3:33 PM José Valim <jose.va...@dashbit.co> wrote:

> This is tricky because at what level do you stop deep merging? What if you
> had other queues? Do you want to delete them? What if you stored it at:
>
> config :core, queues: [my_queue: [global_limit: 1, local_limit: 1]]
>
> Maybe the best would be "delete_config", so you explicitly delete up to a
> certain nesting? For example:
>
> delete_config [:core, :queues, :my_queue]
>
> If this sound sensible, a PR is welcome.
>
> On Thu, Dec 9, 2021 at 3:18 PM Hubert Łępicki <hubert.lepi...@gmail.com>
> wrote:
>
>> I like replace_all_config a lot. I'll wait for some more votes before I
>> start getting my hands dirty implementing it because I'm not entirely
>> convinced it'll be a welcome change. There's always a trade-off between
>> functionality and maintainability that's hard for me to judge.
>>
>> czwartek, 9 grudnia 2021 o 15:15:23 UTC+1 ma...@jonrowe.co.uk napisał(a):
>>
>>> If we were to add something here, I'd suggest `replace_config` or
>>> `replace_all_config` as a name, `put_config` is too similar to what we have
>>> already, given that if you were to `put` just one key in a map it would
>>> ignore other keys.
>>>
>>> Cheers
>>> Jon
>>>
>>> On Thu, 9 Dec 2021, at 2:09 PM, Hubert Łępicki wrote:
>>>
>>> I am stumbling at random intervals, but quite predictably every several
>>> months or so, on the issue that someone in some project created a bug,
>>> because they didn't realize at the moment that changes made in runtime.exs
>>> will be deep-merged with config.exs or prod.exs respectively.
>>>
>>> The most recent example for me is when someone wanted to remove
>>> global_limit from our Oban engine this way:
>>>
>>> # config/config.exs
>>> config :core, :background_jbos, queues: [my_queue: [global_limit: 1,
>>> local_limit: 1]]
>>>
>>> we had this in runtime.exs:
>>> # config/runtime.exs
>>> config :core, :background_jbos, queues: [my_queue: [global_limit: 100,
>>> local_limit: 10]]
>>>
>>> The person changed it to:
>>> # config/runtime.exs
>>> config :core, :background_jbos, queues: [my_queue: [local_limit: 10]]
>>>
>>> i.e. they removed global_limit configuration option, expecting it to
>>> lift the limit completely, instead because configs are deep-merged, it used
>>> global_lmit of 1.
>>>
>>> Obviously everything locked up as the server is quite busy and we had
>>> tens of thousands jobs accumulating in every minute O_o.
>>>
>>> I am raising the issue because I have seen this enough times that I am
>>> thinking a variant of config/2 function that does *not* deep merge with the
>>> existing config key, but replaces it completely could be warranted.
>>>
>>> Obviously naming it is hard but something like Config.put_config/2 could
>>> work for me I think.
>>>
>>> Let me know if that's useful thing to have for other people, maybe it's
>>> a singular issue that only my teams stumble upon xD
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "elixir-lang-core" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to elixir-lang-co...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/elixir-lang-core/5ee865c9-c463-4ae5-8fd2-7663c6c43d0fn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/elixir-lang-core/5ee865c9-c463-4ae5-8fd2-7663c6c43d0fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "elixir-lang-core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to elixir-lang-core+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/93612356-d6b7-49e1-9f8c-8650faacab4cn%40googlegroups.com
>> <https://groups.google.com/d/msgid/elixir-lang-core/93612356-d6b7-49e1-9f8c-8650faacab4cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4J8016vF8Uwze%2Bx-FUGAw%3D06i-nV14k75XxQ-2vFbo-2A%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4J8016vF8Uwze%2Bx-FUGAw%3D06i-nV14k75XxQ-2vFbo-2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Pozdrawiam,
Hubert Łępicki
 -----------------------------------------------
[ http://hubertlepicki.com ]

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CABKQyRqfdwChKSMjF42bAEXP4A%3DQYPVJLLnwxhW34_8WaeSx0A%40mail.gmail.com.

Reply via email to