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

Optional `update_job` callback in `Quantum.Storage` #467

Closed pnezis closed 3 years ago

pnezis commented 3 years ago

Add an optional update_job callback in Quantum.Storage. If this is implemented then it will be called when a job gets updated, otherwise the previous behaviour (delete and then add the job) will be used.

Rationale: I have created a postgres storage and the jobs are linked to other tables through foreign keys. With the current implementation every time a job is updated it deletes the current job and adds it again. I want to be able to just update the properties that have changed and leave everything else untouched.

maennchen commented 3 years ago

Thanks a lot. ❤️ I'll merge when the CI passed.

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 46a44c435babfa68866a30eae98989dc53cab0a4-PR-467


Files with Coverage Reduction New Missed Lines %
lib/quantum/date_library.ex 1 55.0%
test/support/test_storage.ex 1 89.47%
lib/quantum/executor.ex 2 90.91%
lib/quantum/execution_broadcaster.ex 24 41.38%
<!-- Total: 28 -->
Totals Coverage Status
Change from base Build 02e519fe0710b7c64a34762e3d3034d3ffb61aef: -8.02%
Covered Lines: 283
Relevant Lines: 359

💛 - Coveralls
pnezis commented 3 years ago

@maennchen Please have a look at the tests issue I opened. I had to disable the tests locally in order to properly test the changes.

maennchen commented 3 years ago

@pnezis Do you have time to have a look by yourself and open a PR as well? I don't have time at the moment and it may take some time until I can look at it.

pnezis commented 3 years ago

@maennchen Here you are #468

rogeriochaves commented 1 year ago

hey @pnezis, could you share your postgres storage implementation?