Skip to content

Commit 136b716

Browse files
authored
feat: make GetPingPeriod function public (#19)
Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
1 parent 2a965aa commit 136b716

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

usage/ping.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func PingCheck(engineName, category string, pingImmediately bool) {
2727

2828
// PingCheckCtx sends ping events to Google Analytics on a fixed cadence,
2929
// returning when ctx is cancelled. If pingImmediately is true, one event is
30-
// sent before the ticker starts; subsequent events fire every getPingPeriod().
30+
// sent before the ticker starts; subsequent events fire every GetPingPeriod().
3131
func PingCheckCtx(ctx context.Context, engineName, category string, pingImmediately bool) {
3232
// Create a new usage field
3333
u := New()
@@ -40,7 +40,7 @@ func PingCheckCtx(ctx context.Context, engineName, category string, pingImmediat
4040
Send()
4141
}
4242

43-
ticker := time.NewTicker(getPingPeriod())
43+
ticker := time.NewTicker(GetPingPeriod())
4444
defer ticker.Stop()
4545

4646
for {
@@ -57,8 +57,8 @@ func PingCheckCtx(ctx context.Context, engineName, category string, pingImmediat
5757
}
5858
}
5959

60-
// getPingPeriod sets the duration of health events, defaults to 24
61-
func getPingPeriod() time.Duration {
60+
// GetPingPeriod sets the duration of health events, defaults to 24
61+
func GetPingPeriod() time.Duration {
6262
value := env.GetOrDefault(OpenEBSPingPeriod, fmt.Sprint(defaultPingPeriod))
6363
duration, _ := time.ParseDuration(value)
6464
// Sanity checks for setting time duration of health events

usage/ping_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestGetPingPeriod(t *testing.T) {
4949
}
5050
for testKey, testData := range testSuite {
5151
beforeFunc(testData.OpenEBSPingPeriodValue)
52-
evaluatedValue := getPingPeriod()
52+
evaluatedValue := GetPingPeriod()
5353
if evaluatedValue != testData.ExpectedPeriodValue {
5454
t.Fatalf("Tests failed for %s, expected=%d, got=%d", testKey, testData.ExpectedPeriodValue, evaluatedValue)
5555
}

0 commit comments

Comments
 (0)