oban-bg / oban

💎 Robust job processing in Elixir, backed by modern PostgreSQL and SQLite3
https://oban.pro
Apache License 2.0
3.37k stars 313 forks source link

DynamicCron.insert breaks scheduling guarantees #1156

Closed ftes closed 1 month ago

ftes commented 1 month ago

Environment

Current Behavior

Updating an existing cron expression via DynamicCron.insert can lead to that job being immediately re-run, as DynamicCron thinks the last run was missed.

Expected Behavior

Either

  1. oban_crons.insertions should be reset when updating the expression via DynamicCron.insert, just like it is reset when updating via DynamicCron.update
  2. or the docs should clearly state this is not supported

Right now the docs only state

it is better to use update/2 to make targeted updates

sorentwo commented 1 month ago

Thanks for the report and an excellent discovery. This is fixed on main, and we'll also backport to v1.14 for the next patch release.