mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 15:00:27 +08:00
初步完成用户电子邮箱绑定(激活)
This commit is contained in:
@@ -48,7 +48,7 @@ func (this *DNSTaskExecutor) Start() {
|
||||
}
|
||||
|
||||
func (this *DNSTaskExecutor) Loop() error {
|
||||
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
|
||||
if !this.IsPrimaryNode() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ func (this *EventLooper) Start() {
|
||||
}
|
||||
|
||||
func (this *EventLooper) Loop() error {
|
||||
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
|
||||
if !this.IsPrimaryNode() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ func (this *HealthCheckClusterTask) Stop() {
|
||||
// Loop 单个循环任务
|
||||
func (this *HealthCheckClusterTask) Loop() error {
|
||||
// 检查是否为主节点
|
||||
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
|
||||
if !this.IsPrimaryNode() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ func (this *LogTask) RunMonitor() {
|
||||
|
||||
func (this *LogTask) LoopMonitor() error {
|
||||
// 检查是否为主节点
|
||||
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
|
||||
if !this.IsPrimaryNode() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ func (this *NodeMonitorTask) Start() {
|
||||
|
||||
func (this *NodeMonitorTask) Loop() error {
|
||||
// 检查是否为主节点
|
||||
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
|
||||
if !this.IsPrimaryNode() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ func (this *NodeTaskExtractor) Start() {
|
||||
|
||||
func (this *NodeTaskExtractor) Loop() error {
|
||||
// 检查是否为主节点
|
||||
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
|
||||
if !this.IsPrimaryNode() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ func (this *SSLCertExpireCheckExecutor) Start() {
|
||||
// Loop 单次执行
|
||||
func (this *SSLCertExpireCheckExecutor) Loop() error {
|
||||
// 检查是否为主节点
|
||||
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
|
||||
if !this.IsPrimaryNode() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ func (this *SSLCertUpdateOCSPTask) Start() {
|
||||
|
||||
func (this *SSLCertUpdateOCSPTask) Loop() error {
|
||||
// 检查是否为主节点
|
||||
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
|
||||
if !this.IsPrimaryNode() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
package tasks
|
||||
|
||||
import "github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
|
||||
)
|
||||
|
||||
type BaseTask struct {
|
||||
}
|
||||
@@ -10,3 +13,7 @@ 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