Initial commit (code only without large binaries)
This commit is contained in:
19
EdgeAPI/internal/tasks/task_base.go
Normal file
19
EdgeAPI/internal/tasks/task_base.go
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
|
||||
)
|
||||
|
||||
type BaseTask struct {
|
||||
}
|
||||
|
||||
func (this *BaseTask) logErr(taskType string, errString string) {
|
||||
remotelogs.Error("TASK", "run '"+taskType+"' failed: "+errString)
|
||||
}
|
||||
|
||||
func (this *BaseTask) IsPrimaryNode() bool {
|
||||
return models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr()
|
||||
}
|
||||
Reference in New Issue
Block a user