diff --git a/gradle/changelog/random_plugin_center_time.yaml b/gradle/changelog/random_plugin_center_time.yaml new file mode 100644 index 0000000000..ca0a9a6533 --- /dev/null +++ b/gradle/changelog/random_plugin_center_time.yaml @@ -0,0 +1,2 @@ +- type: fixed + description: Use a random time for plugin center updates diff --git a/scm-webapp/src/main/java/sonia/scm/plugin/PluginCenterRefresh.java b/scm-webapp/src/main/java/sonia/scm/plugin/PluginCenterRefresh.java index 196b3aae88..e38b363b2a 100644 --- a/scm-webapp/src/main/java/sonia/scm/plugin/PluginCenterRefresh.java +++ b/scm-webapp/src/main/java/sonia/scm/plugin/PluginCenterRefresh.java @@ -28,6 +28,7 @@ import sonia.scm.EagerSingleton; import sonia.scm.schedule.Scheduler; import javax.inject.Inject; +import java.util.Random; /** * Refresh plugin center cache and refresh the token of plugin center authentication. @@ -40,7 +41,8 @@ public class PluginCenterRefresh { @Inject @SuppressWarnings("java:S1118") // could not hide constructor public PluginCenterRefresh(Scheduler scheduler) { - scheduler.schedule("42 42 0/6 * * ?", RefreshTask.class); + Random random = new Random(); + scheduler.schedule(String.format("%02d %02d 0/6 * * ?", random.nextInt(60), random.nextInt(60)), RefreshTask.class); } public static class RefreshTask implements Runnable {