apache / apache/grails-core

The trigger configuration stored in the database is reset after application restart

Open
#16,197 0 comments 0 reactions 0 assignees View on GitHub
relates-to: grails-quartz
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Howdy!

I have a feeling there is something simple I am missing here, but I have a set of jobs that I allow users to modify the triggers at runtime on the application. This really works well, and I can see that the updated cron expression get stored in the database as well as updated on the job itself.

My challenge is that when my application restarts, Quartz takes the trigger configuration defined in the job itself and overrides (updates) the value previously stored in the database. For instance, I have a job where I define a trigger as follows...

`
static triggers = {
cron cronExpression: '0 15 * ? * * *'
}
`

If I update that expression during runtime, it gets propagated correctly to the database... let's say I replace the expression with '0 20 * ? * * *' and check the database for the correct value. All is good until I have to restart the application.

Once the application restarts I see both the database and the job itself contain the original '0 15 * ? * * *' expression, whereas I expected the previously persisted value to win.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported behavior with a runtime-updated cron expression, then restart the Grails application and compare the job definition with the persisted database value. Trace the job trigger initialization and persistence handling to determine why the original expression is written back. Done means a runtime-updated trigger remains unchanged after restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.