Fix retry task ignoring admin UI disable on restart - #17
Open
mherman22 wants to merge 1 commit into
Open
Conversation
The retry task was created with startOnStartup=true, which causes OpenMRS to auto-start it on every boot regardless of whether it was disabled via the admin UI. Fix: - Restore createTaskIfNotExists() in the activator - Remove the stopTaskIfExists() workaround - On each startup, delete any existing task definition and recreate it with startOnStartup=false. This clears any stale startOnStartup flag from the database. The task runs for the current session via scheduleTask() but won't auto-start on next boot.
Contributor
|
I still think we should stop the task on startup because it’s running in every iSantePlus instance, but let’s also have it set the task to not start on startup as part of that. Good catch @mherman22! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The retry task was created with
startOnStartup=truewhich causes OpenMRS to auto-start it on every boot regardless of whether it was disabled via the admin Manage Scheduled Tasks UI.The previous workaround (commenting out
createTaskIfNotExistsand callingstopTaskIfExistsdid not work because OpenMRS readsstartOnStartupfrom the database and starts the task before any module activator runs.The retry task processes failed PIX/PDQ/XDS messages. On sites where MPI is not configured, these retries produce hundreds of errors per cycle:
Fix
createTaskIfNotExists()in the activator, remove thestopTaskIfExists()workaroundstartOnStartup=false. This clears any stale flag from the database. The task runs for the current session viascheduleTask()but won't auto-start on next boot.Changes
OutgoingMessageExceptionsActivator.java— restorecreateTaskIfNotExists(), removestopTaskIfExists()workaroundRetrySchedulerServiceImpl.java— delete existing task before creating fresh withstartOnStartup=false