refactor: eliminate string/magic-number literals (goconst, mnd) and fix const-type grouping (SA9004)

- upload/task: taskCategoryUpload/taskQueueDefault 常量替代 8 处字面量
- admin: 复用既有 logDBNameSQLite 常量替代 3 处 "sqlite" 字面量
- pkg/cache/disk: defaultCleanupInterval 命名常量
- driver_asynq_worker/executor: 分离 contextKey 类型常量组
lint_issues 45→34, tests 44/44
This commit is contained in:
ryan
2026-08-28 16:38:18 +08:00
parent 528240026d
commit cf85a56aa7
10 changed files with 25 additions and 22 deletions
+2 -2
View File
@@ -146,7 +146,7 @@ func getSQLiteOverview(gormDB *gorm.DB) (DBOverviewResponse, error) {
}
return DBOverviewResponse{
Type: "sqlite",
Type: logDBNameSQLite,
Version: version,
Name: name,
Size: sizeStr,
@@ -499,7 +499,7 @@ func ExecuteSQL(c *gin.Context) {
func getSQLiteInfo(ctx context.Context) DatabaseInfoResponse {
info := DatabaseInfoResponse{
Type: "sqlite",
Type: logDBNameSQLite,
Name: config.Config.Database.SQLitePath,
Version: "SQLite",
}
@@ -175,7 +175,7 @@ type LogDatabaseStatus struct {
// @Router /api/v1/admin/status/log-database [get]
func GetLogDatabaseStatus(c *gin.Context) {
ctx := c.Request.Context()
activeDB := "sqlite"
activeDB := logDBNameSQLite
migration := "idle"
if rc := GetRiskControlService(); rc != nil {
activeDB = rc.ActiveLogEngine(ctx)