mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2024-10-19 03:26:40 +08:00
优化自动检查更新时间控制
This commit is contained in:
parent
d881574a5a
commit
d9a14af021
@ -37,7 +37,7 @@ jobs:
|
|||||||
- name: "Release"
|
- name: "Release"
|
||||||
uses: https://ssl.lunadeer.cn:14446/zhangyuheng/release-action@main
|
uses: https://ssl.lunadeer.cn:14446/zhangyuheng/release-action@main
|
||||||
with:
|
with:
|
||||||
note: "带 `original-` 前缀的文件无法用于运行,请下载不带此前缀的版本。"
|
note: " - 带 `original-` 前缀的文件无法用于运行,请下载不带此前缀的版本。"
|
||||||
files: |-
|
files: |-
|
||||||
staging/*.jar
|
staging/*.jar
|
||||||
api_key: '${{secrets.RELEASE_TOKEN}}'
|
api_key: '${{secrets.RELEASE_TOKEN}}'
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>cn.lunadeer</groupId>
|
<groupId>cn.lunadeer</groupId>
|
||||||
<artifactId>Dominion</artifactId>
|
<artifactId>Dominion</artifactId>
|
||||||
<version>1.22.1-beta</version>
|
<version>1.22.2-beta</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Dominion</name>
|
<name>Dominion</name>
|
||||||
|
@ -12,6 +12,7 @@ import java.io.File;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class GiteaReleaseCheck {
|
public class GiteaReleaseCheck {
|
||||||
@ -30,11 +31,12 @@ public class GiteaReleaseCheck {
|
|||||||
this.current_version = plugin.getPluginMeta().getVersion();
|
this.current_version = plugin.getPluginMeta().getVersion();
|
||||||
// 异步每12小时检查一次更新
|
// 异步每12小时检查一次更新
|
||||||
plugin.getServer().getAsyncScheduler().runAtFixedRate(plugin, (instance) -> {
|
plugin.getServer().getAsyncScheduler().runAtFixedRate(plugin, (instance) -> {
|
||||||
getLatestRelease();
|
getLatestRelease();
|
||||||
if (auto_update) {
|
if (auto_update) {
|
||||||
downloadUpdate();
|
downloadUpdate();
|
||||||
}
|
}
|
||||||
}, 10, 60 * 60 * 12, TimeUnit.SECONDS);
|
}, 10 + new Random().nextInt(10), 60 * 60 * 12 + new Random().nextInt(60),
|
||||||
|
TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableAutoUpdate() {
|
public void enableAutoUpdate() {
|
||||||
|
Loading…
Reference in New Issue
Block a user