mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-10 12:10:26 +08:00
优化代码
This commit is contained in:
@@ -45,7 +45,7 @@ func (this *HealthCheckClusterTask) Reset(config *serverconfigs.HealthCheckConfi
|
||||
this.logErr("HealthCheckClusterTask", err.Error())
|
||||
return
|
||||
}
|
||||
if bytes.Compare(oldJSON, newJSON) != 0 {
|
||||
if !bytes.Equal(oldJSON, newJSON) {
|
||||
this.config = config
|
||||
this.Run()
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ func (this *HealthCheckTask) Loop() error {
|
||||
// 检查是否有变化
|
||||
newJSON, _ := json.Marshal(config)
|
||||
oldJSON, _ := json.Marshal(task.Config())
|
||||
if bytes.Compare(oldJSON, newJSON) != 0 {
|
||||
if !bytes.Equal(oldJSON, newJSON) {
|
||||
remotelogs.Println("TASK", "[HealthCheckTask]update cluster '"+numberutils.FormatInt64(clusterId)+"'")
|
||||
goman.New(func() {
|
||||
task.Reset(config)
|
||||
|
||||
@@ -122,6 +122,9 @@ func (this *SSLCertExpireCheckExecutor) Loop() error {
|
||||
"certId": cert.Id,
|
||||
"acmeTaskId": cert.AcmeTaskId,
|
||||
}.AsJSON())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 更新通知时间
|
||||
err = models.SharedSSLCertDAO.UpdateCertNotifiedAt(nil, int64(cert.Id))
|
||||
@@ -136,6 +139,9 @@ func (this *SSLCertExpireCheckExecutor) Loop() error {
|
||||
"certId": cert.Id,
|
||||
"acmeTaskId": cert.AcmeTaskId,
|
||||
}.AsJSON())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 更新通知时间
|
||||
err = models.SharedSSLCertDAO.UpdateCertNotifiedAt(nil, int64(cert.Id))
|
||||
|
||||
Reference in New Issue
Block a user