How to change the interval or schedule of the DVCS repositories sync
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
The content on this page relates to database updates which are not supported by our Atlassian Support Offerings. Consequently, Atlassian can not guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.
Purpose
The DVCS sync of repositories from GitHub/Bitbucket serves as a fallback mechanism if the webhooks installed on the repository side fail to run for any reason.
By default, the sync is run every hour. This article outlines the steps needed to update the sync interval.
Solution
We need to add an argument to the JVM arguments on startup to set the dvcs.connector.scheduler.interval
property in milliseconds.
For example, if we wish to run the scheduled sync daily:
-Ddvcs.connector.scheduler.interval=86400000
Only one node needs to be restarted for this configuration to be applied.
To completely avoid a restart, we can update the sync interval which is stored in milliseconds in the clusteredjob
table in the database. You need to update the row that belongs to the DVCS sync job.
For example, to update the sync interval to a day:
UPDATE clusteredjob
SET interval_millis=86400000
WHERE job_runner_key='com.atlassian.jira.plugins.dvcs.scheduler.DvcsScheduler';
Important notes
- The change done by the query will not have an impact on the next run of the sync as this is defined by the value in the
next_run
column. - Jira does not need to be restarted;
- The next run of the sync will read the new value of the interval and schedule the subsequent sync accordingly;
- After a Jira restart, the interval will return to the default value of one hour if the JVM argument is not set;
- In order to decide when the next sync will run, you need to:
Update the
next_run
column of the job with the epoch conversion of the time. For instance, the query below will set the next run time to Sunday, December 16, 2018 1:00:00 PM GMT:UPDATE clusteredjob SET next_run= 1544965200000 WHERE job_runner_key='com.atlassian.jira.plugins.dvcs.scheduler.DvcsScheduler';
Restart Jira.
You will still need to set the next run job to something in the future, as this will only set the interval value, Changing the system property after the job has been scheduled does not have any effect so we read it once and use that value throughout the lifetime of the plugin.