chore(util): add default of switch, update err judgment

@formatter:off

Signed-off-by: slasher <shenjie1@oppo.com>
Signed-off-by: JasonHu520 <huzongchao@oppo.com>
This commit is contained in:
slasher 2024-07-23 15:26:17 +08:00 committed by 梁曟風
parent 753475c481
commit b34dfb8de0
5 changed files with 9 additions and 2 deletions

View File

@ -102,6 +102,7 @@ func (s *Service) syncDiskStatus(ctx context.Context, diskInfosRet []*cmapi.Disk
span.Warnf("disk drop: diskID:%d local.Status:%v, cm.status:%v", diskID, ds.Status(), status)
s.handleDiskDrop(ctx, ds)
continue
default:
}
}
}

View File

@ -17,6 +17,7 @@ package taskswitch
import (
"context"
"errors"
"strings"
"sync"
"time"
@ -127,7 +128,7 @@ func (sm *SwitchMgr) update() {
statusStr, err := sm.accessor.GetConfig(ctx, switchName)
if err != nil {
span.Errorf("Get Fail switchName %s err %v", switchName, err)
if err == errcode.ErrNotFound {
if strings.Contains(err.Error(), errcode.ErrNotFound.Error()) {
if err = sm.accessor.SetConfig(ctx, switchName, SwitchClose); err != nil {
span.Errorf("Set Fail switchName %s err %v", switchName, err)
}

View File

@ -50,6 +50,7 @@ func (d spanOptionDuration) Value(duration time.Duration) int64 {
v = int64(duration / time.Minute)
case durationHour:
v = int64(duration / time.Hour)
default:
}
return v
}
@ -68,8 +69,9 @@ func (d spanOptionDuration) Unit(duration time.Duration) string {
return "m"
case durationHour:
return "h"
default:
return ""
}
return ""
}
type spanOptions struct {

View File

@ -100,6 +100,7 @@ func SupportPanicHook() (ok bool) {
switch runtime.GOARCH {
case "amd64", "386":
ok = supportTest()
default:
}
return
}

View File

@ -231,6 +231,8 @@ func String2Any(str string, pvalue interface{}) error {
*v = complex64(val.(complex128))
case *complex128:
*v = complex128(val.(complex128))
default:
}
return nil
}