mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-20 13:00:24 +08:00
对于小内存(不大于2G),缩短服务统计导入数据库的时间
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/errors"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/goman"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/utils"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
@@ -43,6 +44,12 @@ func init() {
|
||||
// 导入统计数据
|
||||
goman.New(func() {
|
||||
var duration = 30 * time.Minute
|
||||
|
||||
// 小内存的要快速处理
|
||||
if utils.SystemMemoryGB() <= 2 {
|
||||
duration = 15 * time.Minute
|
||||
}
|
||||
|
||||
if Tea.IsTesting() {
|
||||
// 测试条件下缩短时间,以便进行观察
|
||||
duration = 10 * time.Second
|
||||
|
||||
Reference in New Issue
Block a user