This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-599fbc0f-e71d-45c7-b8c2-12ecc30a770d XWIKI-25261 Open

Scheduler job pages are saved again at each startup

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-f89ca677-b49d-4956-ae8b-bbc529d09894 Claude created this issue on 11/Oct/26 17:13
 
Summary: Scheduler job pages are saved again at each startup
Issue Type: cid:jira-generated-image-avatar-599fbc0f-e71d-45c7-b8c2-12ecc30a770d Bug
Affects Versions: 18.8.0
Assignee: Unassigned
Components: Scheduler
Created: 11/Oct/26 17:13
Priority: cid:jira-generated-image-static-major-ab2dfa1f-c691-42d8-9be6-ef0f726db2a5 Major
Reporter: Claude
Description:

Problem

At each startup, the Scheduler plugin restores the jobs from their pages (the XWiki.SchedulerJobClass objects) of every wiki. The scheduler keeps its jobs in memory, so all of them are new for it at startup, and in that case SchedulerPlugin#scheduleJob saves the status of the job (Normal or Paused) in the job page, even when the page already holds that status.

Saving the same value is not a no-op: setting the value of a property marks the object as modified, so each of these saves creates a new version of the job page. Every job page gets a new version at every startup (on every cluster member running the scheduler), without any change, and each save notifies the document update listeners.

In addition, these saves are meant to be minor edits, but XWiki#saveDocument(XWikiDocument, XWikiContext) resets the minor edit flag set on the document, so each of them creates a major version (1.1, 2.1, 3.1, and so on). The same happens to the save done when the execution context of a job (user, language, wiki) is filled the first time the job is scheduled.

XWIKI-8162 fixed the same symptom in 4.2. The code was read on 18.8.0 and the behaviour is older than this version.

Proposal

  • Save the status of the job only when it differs from the status stored in the job page.
  • Save the job page as a minor edit, as intended, by passing the minor edit flag to XWiki#saveDocument.