Skip to content

Commit

Permalink
Merge pull request #2807 from actiontech/remove_clean_workflow_job_04
Browse files Browse the repository at this point in the history
Remove clean workflow job 04
  • Loading branch information
ColdWaterLW authored Dec 10, 2024
2 parents 17a8d99 + 7f6fb03 commit 99281e3
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 42 deletions.
16 changes: 0 additions & 16 deletions sqle/api/controller/v1/configuration.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package v1

import (
"fmt"
"net/http"
"strconv"

Expand Down Expand Up @@ -79,7 +78,6 @@ func TestDingTalkConfigV1(c echo.Context) error {
}

type UpdateSystemVariablesReqV1 struct {
WorkflowExpiredHours *int `json:"workflow_expired_hours" form:"workflow_expired_hours" example:"720"`
Url *string `json:"url" form:"url" example:"http://10.186.61.32:8080" validate:"url"`
OperationRecordExpiredHours *int `json:"operation_record_expired_hours" form:"operation_record_expired_hours" example:"2160"`
}
Expand All @@ -102,12 +100,6 @@ func UpdateSystemVariables(c echo.Context) error {
s := model.GetStorage()

var systemVariables []model.SystemVariable
if req.WorkflowExpiredHours != nil {
systemVariables = append(systemVariables, model.SystemVariable{
Key: model.SystemVariableWorkflowExpiredHours,
Value: fmt.Sprintf("%v", *req.WorkflowExpiredHours),
})
}

if req.OperationRecordExpiredHours != nil {
systemVariables = append(systemVariables, model.SystemVariable{
Expand Down Expand Up @@ -136,7 +128,6 @@ type GetSystemVariablesResV1 struct {
}

type SystemVariablesResV1 struct {
WorkflowExpiredHours int `json:"workflow_expired_hours"`
Url string `json:"url"`
OperationRecordExpiredHours int `json:"operation_record_expired_hours"`
}
Expand All @@ -154,12 +145,6 @@ func GetSystemVariables(c echo.Context) error {
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}

expiredHours, err := strconv.Atoi(systemVariables[model.SystemVariableWorkflowExpiredHours].Value)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}

operationRecordExpiredHours, err := strconv.Atoi(systemVariables[model.SystemVariableOperationRecordExpiredHours].Value)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
Expand All @@ -168,7 +153,6 @@ func GetSystemVariables(c echo.Context) error {
return c.JSON(http.StatusOK, &GetSystemVariablesResV1{
BaseRes: controller.NewBaseReq(nil),
Data: SystemVariablesResV1{
WorkflowExpiredHours: expiredHours,
Url: systemVariables[model.SystemVariableSqleUrl].Value,
OperationRecordExpiredHours: operationRecordExpiredHours,
},
Expand Down
7 changes: 0 additions & 7 deletions sqle/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12214,9 +12214,6 @@ var doc = `{
},
"url": {
"type": "string"
},
"workflow_expired_hours": {
"type": "integer"
}
}
},
Expand Down Expand Up @@ -12701,10 +12698,6 @@ var doc = `{
"url": {
"type": "string",
"example": "http://10.186.61.32:8080"
},
"workflow_expired_hours": {
"type": "integer",
"example": 720
}
}
},
Expand Down
7 changes: 0 additions & 7 deletions sqle/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -12198,9 +12198,6 @@
},
"url": {
"type": "string"
},
"workflow_expired_hours": {
"type": "integer"
}
}
},
Expand Down Expand Up @@ -12685,10 +12682,6 @@
"url": {
"type": "string",
"example": "http://10.186.61.32:8080"
},
"workflow_expired_hours": {
"type": "integer",
"example": 720
}
}
},
Expand Down
5 changes: 0 additions & 5 deletions sqle/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2770,8 +2770,6 @@ definitions:
type: integer
url:
type: string
workflow_expired_hours:
type: integer
type: object
v1.Table:
properties:
Expand Down Expand Up @@ -3099,9 +3097,6 @@ definitions:
url:
example: http://10.186.61.32:8080
type: string
workflow_expired_hours:
example: 720
type: integer
type: object
v1.UpdateWechatConfigurationReqV1:
properties:
Expand Down
13 changes: 7 additions & 6 deletions sqle/model/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (

const (
DefaultOperationRecordExpiredHours = 90 * 24
DefaultCbOperationLogsExpiredHours = 90 * 24
)

// SystemVariable store misc K-V.
Expand Down Expand Up @@ -51,12 +52,12 @@ func (s *Storage) GetAllSystemVariables() (map[string]SystemVariable, error) {
sysVariables[sv.Key] = sv
}

if _, ok := sysVariables[SystemVariableWorkflowExpiredHours]; !ok {
sysVariables[SystemVariableWorkflowExpiredHours] = SystemVariable{
Key: SystemVariableWorkflowExpiredHours,
Value: strconv.Itoa(30 * 24),
}
}
// if _, ok := sysVariables[SystemVariableWorkflowExpiredHours]; !ok {
// sysVariables[SystemVariableWorkflowExpiredHours] = SystemVariable{
// Key: SystemVariableWorkflowExpiredHours,
// Value: strconv.Itoa(30 * 24),
// }
// }

if _, ok := sysVariables[SystemVariableOperationRecordExpiredHours]; !ok {
sysVariables[SystemVariableOperationRecordExpiredHours] = SystemVariable{
Expand Down
2 changes: 1 addition & 1 deletion sqle/server/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewCleanJob(entry *logrus.Entry) ServerJob {
}

func (j *CleanJob) job(entry *logrus.Entry) {
j.CleanExpiredWorkflows(entry)
// j.CleanExpiredWorkflows(entry) /* 不再自动销毁工单(目前没有使用场景)*/
j.CleanExpiredTasks(entry)
j.CleanExpiredOperationLog(entry)
}
Expand Down

0 comments on commit 99281e3

Please sign in to comment.