feat: 优化systemctl中判断service文件是否存在的函数 #2615
Merged
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.
What this PR does / why we need it?
我发现在我的机器上,当点击
主机
->进程守护
时,页面加载并不是很快,需要等待3秒左右的服务器返回时间,因为调用了systemctl 判断service文件是否存在的函数导致的。我想要减少等待。SSH管理
的配置加载也因为这个需要等待1秒左右。优化后在我的机器上等待时间变为了毫秒。Summary of your change
优化systemctl中判断service文件是否存在的函数
将原先列出文件的命令
list-unit-files
改为is-enabled
进行判断Please indicate you've done the following: