MCPcopy
hub / github.com/deepops-ai/deepops / Init

Function Init

backend/internal/task/task.go:13–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11var logger = colorlog.RootLogger.New("logger", "task")
12
13func Init() {
14 for {
15 now := time.Now()
16 hour := now.Hour()
17 if hour == 3 {
18 expires := now.Add(-1 * time.Duration(config.Data.Task.CleanAnnotations) * time.Hour * 24)
19
20 res, err := db.Conn.Exec("DELETE FROM annotation WHERE created < ?", expires)
21 if err != nil {
22 logger.Error("task: clean annotation", "error", err)
23 goto SLEEP
24 }
25 n, _ := res.RowsAffected()
26 logger.Info("Task: remove annotations", "count", n)
27 }
28 SLEEP:
29 time.Sleep(1 * time.Hour)
30 }
31}

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.65
InfoMethod · 0.65

Tested by

no test coverage detected