Restart delay#5741
Open
Tianming-Wu wants to merge 7 commits into
Open
Conversation
Contributor
Author
|
Also it is possible to disable this feature by setting the |
Contributor
|
凭什么要延迟启动alas😅演习怎么办 |
Contributor
Author
除非你需要卡时间冲军衔,否则演习并没有必须在刷新之后立刻执行的需求。 这是在开发群讨论过的问题,零点大量设备重启会对黄鸡的服务器造成很大的压力。我所有设备基本上都会在午夜演习期间因为卡网重启 1~2 次。 你真的需要立刻执行可以关掉这个。 |
Contributor
|
你这样说那我的设备并不会卡重启。不应该默认大家都等,你觉得国服有问题可以只对国服生效。 |
Contributor
Author
Contributor
Author
|
@LmeSzinc 催审核,至少给个意见 |
LmeSzinc
reviewed
Jul 1, 2026
LmeSzinc
left a comment
Owner
There was a problem hiding this comment.
先想好怎么实现吧,纯等肯定是不接受的,一些任务不受跨天影响可以继续运行
Comment on lines
+168
to
+179
| # Random delay when triggered at midnight to avoid server load spikes | ||
| # During this delay, other tasks are naturally blocked because | ||
| # Restart is the currently running task (highest priority at 0:00) | ||
| if self.config.Restart_MidnightRandomDelay_Enable: | ||
| max_delay = self.config.Restart_MidnightRandomDelay_MaxSeconds | ||
| now = datetime.now() | ||
| if now.hour == 0 and now.minute < 5 and max_delay > 0: | ||
| delay = random.randint(0, max_delay) | ||
| if delay > 0: | ||
| logger.info(f'Restart at midnight: random delay {delay}s' | ||
| f' (all tasks blocked)') | ||
| self.device.sleep(delay) |
Comment on lines
+20
to
+28
| # Group `Restart` | ||
| Restart_Scheduler_Enable = False | ||
| Restart_Scheduler_NextRun = datetime.datetime(2020, 1, 1, 0, 0) | ||
| Restart_Scheduler_Command = 'Restart' | ||
| Restart_Scheduler_SuccessInterval = 0 | ||
| Restart_Scheduler_FailureInterval = 120 | ||
| Restart_Scheduler_ServerUpdate = '00:00' | ||
| Restart_MidnightRandomDelay_Enable = False # True, False | ||
| Restart_MidnightRandomDelay_MaxSeconds = 300 |
Contributor
Author
There was a problem hiding this comment.
前面生成的多余的修了(还没提交)。
这里有三个层级是因为配置里面是这样写的:
Restart:
MidnightRandomDelay:
Enable:
type: checkbox
value: false
option: [ true, false ]
MaxSeconds:
value: 300可以工作,并且语义也足够清晰。一定要改成两层的也可以改
Contributor
Author
这些任务执行的时候也会出现卡网络的现象,这个目标是解决卡网络以及零点附近游戏反复重启的问题,跨天时一并阻塞我认为属于期望的行为 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Alas restart the game everyday at 0:00, this will put some pressure on the server, and the game may crash several times.
This edit adds a configurable random delay for the midnight restart (does not affect restart in other cases, unless it is still within 0:00~0:05)。
The config is not exposed to user. It is in
config_manual.py, as keySCHEDULER_RESTART_RANDOM_DELAYin seconds. The default value is set to 300s (5min), it might not be the best value.