quantum-elixir / quantum-core

:watch: Cron-like job scheduler for Elixir
https://hexdocs.pm/quantum/
Apache License 2.0
2.3k stars 147 forks source link

Quantum.Job.new/1 doesn't accept custom name #498

Closed LostKobrakai closed 2 years ago

LostKobrakai commented 2 years ago

Quantum.Job.new/1 seems to accept all fields for a job, but not the name.

maennchen commented 2 years ago

@LostKobrakai Hm. It seems that I forgot to set @doc false on this. The idea is to use YourScheduler.new_job() and then call Quantum.Job.set_name on it. The reason for that is that the scheduler needs to pass some scheduler config to the job.

I see though that it would be nice to be able to configure all properties at once.

I'll have a look at this next week.

LostKobrakai commented 2 years ago

I‘m using ˋMyApp.Scheduler.new_job()ˋ, but as you guessed it‘s strange to be able to pass a keyword list, if the expectation is to use the explicit API. And otoh it‘s strange to not be able to set the name via the keyword list, if that‘s intended use. Also as usual with keyword list options it‘s even a silent error you need to discover with tests.

maennchen commented 2 years ago

@LostKobrakai What do you think of #500?

LostKobrakai commented 2 years ago

This looks good, though today I noticed the same behaviour of :name also applies to :task. Would be great if that one could be considered as well.

maennchen commented 2 years ago

@LostKobrakai Good point, I'll have a look, that all options are supported.

maennchen commented 2 years ago

@LostKobrakai Updated, ok now?

LostKobrakai commented 2 years ago

Looks good to me.