samsondav / rihanna

Rihanna is a high performance postgres-backed job queue for Elixir
MIT License
439 stars 47 forks source link

Make startup delay configurable #51

Closed mtarnovan closed 5 years ago

mtarnovan commented 5 years ago

The startup delay is currently dependent on compile time Mix configuration. Because dependencies are always compiled in :prod, this means that this startup_delay will default to 5 seconds even in test envs. This PR makes this runtime configurable, so you can initialize it in your test env with a lower value, for example like this:

setup do
    {:ok, _} =
      start_supervised({
        Rihanna.Supervisor,
        [postgrex: Repo.config(), startup_delay: 0, name: Rihanna.Supervisor]
      })
...
samsondav commented 5 years ago

@lpil definitely in favour of making everything configurable at runtime.

lpil commented 5 years ago

Fab! Do we want to move the mix config parts to runtime?

I'm not a big fan of mix config but would rather not have half-and-half configuration split across two approaches.

samsondav commented 5 years ago

I think we can have a stacked approach.

Runtime > Mix > Defaults

lpil commented 5 years ago

Dig it. Shall we add this as mix config to make it uniform and then add the runtime configuration as a later PR?

samsondav commented 5 years ago

Sounds great.

lpil commented 5 years ago

Hi @mtarnovan, if you'd like to move these options to mix config we can get this reviewed and merged in :)

mtarnovan commented 5 years ago

Hi @lpil - hope I understood you correctly. This config key is now fetched in the order runtime > mix > defaults.

samsondav commented 5 years ago

@lpil I'm happy with this if you are.

lpil commented 5 years ago

Oops, I should have bumped the version in this pr. I'll make a new one.