mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 03:35:11 +01:00
Made the GitHub connection interval be at least 15 minutes
This commit is contained in:
parent
2d94e4447a
commit
a3a50c1961
@ -178,8 +178,8 @@ public class Settings implements DataObject {
|
||||
|
||||
@ConfigComment("Time in minutes between each connection to the GitHub API.")
|
||||
@ConfigComment("This allows for up-to-the-minute information gathering.")
|
||||
@ConfigComment("However, as the GitHub API data does not get updated instantly, it is recommended to keep")
|
||||
@ConfigComment("this value greater than 15 minutes.")
|
||||
@ConfigComment("However, as the GitHub API data does not get updated instantly,")
|
||||
@ConfigComment("this value cannot be set less than 15 minutes.")
|
||||
@ConfigComment("Setting this to 0 will make BentoBox download data only at startup.")
|
||||
@ConfigEntry(path = "web.github.connection-interval", since = "1.5.0")
|
||||
private int githubConnectionInterval = 60;
|
||||
|
@ -37,8 +37,11 @@ public class WebManager {
|
||||
|
||||
long connectionInterval = plugin.getSettings().getGithubConnectionInterval() * 20L * 60L;
|
||||
if (connectionInterval <= 0) {
|
||||
// If below 0, it means we shouldn't run this as a repeating task.
|
||||
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, () -> requestGitHubData(true), 20L);
|
||||
} else {
|
||||
// Set connection interval to be at least 15 minutes.
|
||||
connectionInterval = Math.min(connectionInterval, 15 * 20 * 60L);
|
||||
plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, () -> requestGitHubData(true), 20L, connectionInterval);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user