瀏覽代碼

chore: remove conf.CheckedDuration (#1235)

Kevin Wan 3 年之前
父節點
當前提交
11f85d1b80
共有 2 個文件被更改,包括 0 次插入30 次删除
  1. 0 16
      core/conf/time.go
  2. 0 14
      core/conf/time_test.go

+ 0 - 16
core/conf/time.go

@@ -1,16 +0,0 @@
-package conf
-
-import "time"
-
-const minDuration = 100 * time.Microsecond
-
-// CheckedDuration returns the duration that guaranteed to be greater than 100us.
-// Why we need this is because users sometimes intend to use 500 to represent 500ms.
-// In config, duration less than 100us should always be missing ms etc.
-func CheckedDuration(duration time.Duration) time.Duration {
-	if duration > minDuration {
-		return duration
-	}
-
-	return duration * time.Millisecond
-}

+ 0 - 14
core/conf/time_test.go

@@ -1,14 +0,0 @@
-package conf
-
-import (
-	"testing"
-	"time"
-
-	"github.com/stretchr/testify/assert"
-)
-
-func TestCheckedDuration(t *testing.T) {
-	assert.Equal(t, time.Second, CheckedDuration(1000))
-	assert.Equal(t, 2*time.Second, CheckedDuration(2000))
-	assert.Equal(t, 2*time.Second, CheckedDuration(time.Second*2))
-}