You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
524 B
24 lines
524 B
4 months ago
|
package initialize
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"service-api/config"
|
||
|
"service-api/global"
|
||
|
"service-api/utils"
|
||
|
)
|
||
|
|
||
|
func Timer() {
|
||
|
if global.MG_CONFIG.Timer.Start {
|
||
|
for _, detail := range global.MG_CONFIG.Timer.Detail {
|
||
|
go func(detail config.Detail) {
|
||
|
global.MG_Timer.AddTaskByFunc("ClearDB", global.MG_CONFIG.Timer.Spec, func() {
|
||
|
err := utils.ClearTable(global.MG_DB, detail.TableName, detail.CompareField, detail.Interval)
|
||
|
if err != nil {
|
||
|
fmt.Println("timer error:", err)
|
||
|
}
|
||
|
})
|
||
|
}(detail)
|
||
|
}
|
||
|
}
|
||
|
}
|