mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-07 22:55:58 +02:00
Use a random time for plugin center updates
Pushed-by: Rene Pfeuffer<rene.pfeuffer@cloudogu.com> Co-authored-by: René Pfeuffer<rene.pfeuffer@cloudogu.com>
This commit is contained in:
2
gradle/changelog/random_plugin_center_time.yaml
Normal file
2
gradle/changelog/random_plugin_center_time.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: fixed
|
||||
description: Use a random time for plugin center updates
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user