mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
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:
parent
753475c481
commit
b34dfb8de0
@ -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:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -100,6 +100,7 @@ func SupportPanicHook() (ok bool) {
|
||||
switch runtime.GOARCH {
|
||||
case "amd64", "386":
|
||||
ok = supportTest()
|
||||
default:
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -231,6 +231,8 @@ func String2Any(str string, pvalue interface{}) error {
|
||||
*v = complex64(val.(complex128))
|
||||
case *complex128:
|
||||
*v = complex128(val.(complex128))
|
||||
|
||||
default:
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user