Skip to content

Commit 6d036b4

Browse files
committed
review suggestions
1 parent 07fdf7f commit 6d036b4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Diff for: pkg/gofr/gofr.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ const (
4747
shutServerPing = "/api/ping/down"
4848
pingTimeout = 5 * time.Second
4949
defaultTelemetry = "true"
50-
telmetryStart = "start"
51-
telemetryEnd = "shutdown"
50+
telmetryStart = true
51+
telemetryEnd = false
5252
)
5353

5454
// App is the main application in the GoFr framework.
@@ -243,13 +243,13 @@ func (a *App) hasTelemetry() bool {
243243
return a.Config.GetOrDefault("GOFR_TELEMETRY", defaultTelemetry) == "true"
244244
}
245245

246-
func (a *App) sendTelemetry(client *http.Client, s string) {
246+
func (a *App) sendTelemetry(client *http.Client, status bool) {
247247
url := fmt.Sprint(gofrHost, shutServerPing)
248248

249-
if s == "start" {
249+
if status == true {
250250
url = fmt.Sprint(gofrHost, startServerPing)
251251

252-
a.container.Info("GoFr tracks running servers via telemetry. Set GOFR_TELEMETRY=false in configs to disable it.")
252+
a.container.Info("GoFr records the number of active servers. Set GOFR_TELEMETRY=false in configs to disable it.")
253253
}
254254

255255
ctx, cancel := context.WithTimeout(context.Background(), pingTimeout)

Diff for: pkg/gofr/gofr_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ func (m *mockRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
8787
func TestPingGoFr(t *testing.T) {
8888
tests := []struct {
8989
name string
90-
input string
90+
input bool
9191
expectedURL string
9292
}{
93-
{"Ping Start Server", "start", gofrHost + startServerPing},
94-
{"Ping Shut Server", "stop", gofrHost + shutServerPing},
93+
{"Ping Start Server", true, gofrHost + startServerPing},
94+
{"Ping Shut Server", false, gofrHost + shutServerPing},
9595
}
9696

9797
for _, tt := range tests {

0 commit comments

Comments
 (0)