kagkarlsson / db-scheduler

Persistent cluster-friendly scheduler for Java
Apache License 2.0
1.25k stars 191 forks source link

Add ability to use alternate CRON types in CronSchedule #384

Closed tom-mckenzie-nuix closed 1 year ago

tom-mckenzie-nuix commented 1 year ago

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

Expected Behavior

I want to be able to use a Quartz-style cron expression which includes a field for year. This would allow me to use recurring tasks which stop recurring after a set time. CronDefinitionBuilder already seems to support this, along with all the other styles listed in the CronType enum.

Current Behavior

CronSchedule is hard-coded to use spring-style cron expressions which do not support a year.


For bug reports

YOU MAY DELETE THE For bug reports SECTION IF A NEW FEATURE REQUEST.

Steps to Reproduce the bug

1. 1. 1.

Context

Logs

tom-mckenzie-nuix commented 1 year ago

I'm happy to submit a PR for this if I can get permission to push a branch.

kagkarlsson commented 1 year ago

This sounds like a neat addition to the CronSchedule, feel free to create a PR. You can fork the repo and create the new branch in your fork and then create the PR from there.

CronSchedule is Serializable, so there might exist persisted schedules. This means that when deserialized, the field for crontype will be null, so the class must handle those cases. We probably need to test that as well before release, that we support null for crontype.

kagkarlsson commented 1 year ago

Fixed in v12.2.0. Thanks for contributing!