优化操作系统和浏览器统计相关程序

This commit is contained in:
刘祥超
2022-11-11 17:48:30 +08:00
parent 99e1658fdf
commit ae14ff4f9f
24 changed files with 1055 additions and 127 deletions

File diff suppressed because one or more lines are too long

View File

@@ -40,6 +40,14 @@ var recordsTables = []*SQLRecordsTable{
UniqueFields: []string{"name"},
ExceptFields: []string{"customName", "customCodes"},
},
{
TableName: "edgeFormalClientSystems",
UniqueFields: []string{"dataId"},
},
{
TableName: "edgeFormalClientBrowsers",
UniqueFields: []string{"dataId"},
},
}
type sqlItem struct {

View File

@@ -89,7 +89,7 @@ var upgradeFuncs = []*upgradeVersion{
"0.5.6", upgradeV0_5_6,
},
{
"0.5.7", upgradeV0_5_7,
"0.5.8", upgradeV0_5_8,
},
}

View File

@@ -11,6 +11,7 @@ import (
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
"github.com/iwind/TeaGo/dbs"
"github.com/iwind/TeaGo/types"
timeutil "github.com/iwind/TeaGo/utils/time"
"regexp"
)
@@ -178,7 +179,7 @@ func upgradeV0_5_6(db *dbs.DB) error {
}
// v0.5.7
func upgradeV0_5_7(db *dbs.DB) error {
func upgradeV0_5_8(db *dbs.DB) error {
// node task versions
{
_, err := db.Exec("UPDATE edgeNodeTasks SET version=0 WHERE LENGTH(version)=19")
@@ -187,5 +188,20 @@ func upgradeV0_5_7(db *dbs.DB) error {
}
}
// 删除操作系统和浏览器相关统计
// 只删除当前月,避免因为数据过多阻塞
{
_, err := db.Exec("DELETE FROM edgeServerClientSystemMonthlyStats WHERE month=?", timeutil.Format("Ym"))
if err != nil {
return err
}
}
{
_, err := db.Exec("DELETE FROM edgeServerClientBrowserMonthlyStats WHERE month=?", timeutil.Format("Ym"))
if err != nil {
return err
}
}
return nil
}