From 11f85d1b805d5e83efb65585fd48466be3128684 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Sat, 13 Nov 2021 23:34:30 +0800 Subject: [PATCH] chore: remove conf.CheckedDuration (#1235) --- core/conf/time.go | 16 ---------------- core/conf/time_test.go | 14 -------------- 2 files changed, 30 deletions(-) delete mode 100644 core/conf/time.go delete mode 100644 core/conf/time_test.go diff --git a/core/conf/time.go b/core/conf/time.go deleted file mode 100644 index be47300c..00000000 --- a/core/conf/time.go +++ /dev/null @@ -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 -} diff --git a/core/conf/time_test.go b/core/conf/time_test.go deleted file mode 100644 index 130e0748..00000000 --- a/core/conf/time_test.go +++ /dev/null @@ -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)) -}